Start typing to search packages!
slidermodule
By @aerodymier
Roblox
MirroredSliderModule
This is a module I made for slider GUIs which works with scale instead of the widely used offset.
Getting Started
Installation
You can get the module with copying the module from src/shared or you can use Wally to get the module:
Add this to your [dependencies]:
SliderModule = "aerodymier/slidermodule@^0.2.4"
... or just get it from Roblox creator marketplace (might be out of date):
https://www.roblox.com/library/10138561854/SliderModule
If you want to use Roblox Studio in your project I recommend downloading the module file on Releases tab.
Usage
You can create a new Slider instance with SliderModule.new():
local newSlider = SliderModule.new(slidingBase, sliderMarker, sliderButton,
{
min = min,
max = max,
snapFactor = snapFactor,
},
{
TextBox = valueText,
DefaultValue = defaultValue,
})
slidingBase is the frame slider head will slide on. (Type: Frame) (Required)
sliderMarker is the slider head. (Type: Frame) (Required)
sliderButton is the button which needs to be parented to the slideMarker. (Type: TextButton or ImageButton) (Required)
Fourth variable is sliderConfigurations. This one has to have min, max, snapFactor values. (All required)
min: Minimum value of your slider. (Type: number)max: Maximum value of your slider. (Type: number)snapFactor: Step value between 0 and 1. (Type: number)
Fifth variable is extras. This one can have a TextBox or a TextLabel value. (Not required)
TextLabel: The TextLabel which will get updated when value changes. Has priority overTextBoxon displaying values. (Type: TextLabel)TextBox: If you want the player to set a custom value betweenminandmaxvalues manually, use this. This applies the user specified value toself.CurrentValuewhen focus is lost from the TextBox with also moving the marker to the suitable location. Has required checks for number entries. If aTextLabelis not specified, this will get used on displaying values. (Type: TextBox)Decimals: The decimals you want to show in the sliderTextLabelorTextBox. Defaults to 1. (Type: number)DefaultValue: The default value you want to set to slider. This will automatically place the slider head to the target value and the TextLabel or TextBox if available. Will be set after Slider:Activate() gets called. (Type: number)
There are some functions on Slider object.
Slider:Activate(): Activates the slider and if it's the first run then sets the DefaultValue if available.
- Arguments: void
- Returns: void
Slider:Deactivate(): Deactivates the slider with disconnecting events. - Arguments: void
- Returns: void
There are some events with a Slider object as well.
Slider.InteractionBegan - Fires when player starts interacting with the slider.
- Type: BindableEvent
- Returns: void
Slider.InteractionEnded - Fires when player stops interacting with the slider.
- Type: BindableEvent
- Returns: (number) LastValue - Returns the last value of the slider
Slider.ValueChanged - Fires when value changes to a new one.
- Type: BindableEvent
- Returns: (number) CurrentValue - Returns the current value of the slider
Examples
There is also an example of this module working in this repo. Place file is in PlaceFile folder and all scripts are located in src folder. Warning for beginners, do not sync this with your own project. The default.project.json file is set to overwriting the contents of target services. Instead, you should copy the module or use Wally.
Package Details
Install command (Click to copy)
Version
0.2.4
License
MIT
Safe for commercial use
License identified from the packaged LICENSE file; the manifest declared none.
Automated license review — not legal advice.
