Making Slider GUI for particle speed

What ways or tools could I use to make a Slider GUI, like a vertical slider to change the speed of a particle, colors, or some things like that?

Are there any pages or forums that go into that?
Are there any plugins that do this for you?

Do you mean in-game or in studios? It’s already built-in feature of studio to modify particle’s speed.

A slider should show up in the game, for the purpose of changing the speed in smaller increments. Cause the feature in the studio only goes by 1’s, where I want it to be smaller, like 0, 0.05, 0.1, etc.

There are a couple topics that talk about this already.

1 Like

Well, I found an example script. But how would I get data from a ParticleEmitter into part of this script? Seems a bit messy, can’t find exactly where I would have to add it.

-- Setting up unchanging variables
local bar = script.Parent.Bar;
local knob = bar.Knob;
local valueChangedEvent = script.Parent.ValueChanged;
local startXScale = -.05;
local endXScale = .95;
local mouse = game:GetService("Players").LocalPlayer:GetMouse()

-- Updates the position of the knob as well as the value
local prevValue = nil;
local function Update()
	local absPosition = script.Parent.Bar.AbsolutePosition.X;
	local absSize = script.Parent.Bar.AbsoluteSize.X;
	local mouseDelta = math.min(math.max(0, mouse.X - absPosition), absSize);
	local value = script.Parent.MinValue.Value + ((mouseDelta / absSize) * (script.Parent.MaxValue.Value - script.Parent.MinValue.Value));
	knob.Position = UDim2.new((mouseDelta / absSize) - .05, knob.Position.X.Offset, knob.Position.Y.Scale, knob.Position.Y.Offset);
	if (prevValue ~= nil and math.floor(prevValue) ~= math.floor(value)) then
		valueChangedEvent:Fire(prevValue, math.floor(value));
		prevValue = math.floor(value);
	else
		prevValue = math.floor(value);
	end
end

-- Coroutine to keep updating
local keepUpdating = false;
local function Updater()
	while (true) do
		if (keepUpdating) then
			Update()
		end
		wait(.05)
	end
end
local taskCoro = coroutine.create(Updater)
coroutine.resume(taskCoro);

-- Event Connecting
knob.MouseButton1Down:Connect(function()
	keepUpdating = true;
end)
local UserInputService = game:GetService("UserInputService")
UserInputService.InputEnded:Connect(function(inputObject)
	if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
		keepUpdating = false;
	end
end)

You would have to listen to the valueChangedEvent event. Then use the first argument passed to the listener, to update the necessary properties. It also looks like you could use the prevValue as well.

local value = script.Parent.MinValue.Value + ((mouseDelta / absSize) * (script.Parent.MaxValue.Value - script.Parent.MinValue.Value));
	knob.Position = UDim2.new((mouseDelta / absSize) - .05, knob.Position.X.Offset, knob.Position.Y.Scale, knob.Position.Y.Offset);
	if (prevValue ~= nil and math.floor(prevValue) ~= math.floor(value)) then
		valueChangedEvent:Fire(prevValue, math.floor(value));
		prevValue = math.floor(value);
	else
		prevValue = math.floor(value);
	end
end

I’m assuming it is this bit of code
How would I implement code that finds the particle’s speed?

The variable prevValue is the value of the slider, use that.

A:

You could use Roblox’s SurfaceGui and ScreenGui for this.
SurfaceGui has some limitations, as a result of being a SurfaceGui, but it should work fine for this application.
Here’s a simple slider I made, which you can use as a base for what you’re trying to do:

I think this is a good way to start, as a visible UI is a nice way to show the information to the user.
You could also use the BindableEvent in the ValueChanged event to display the value in the chat, or some other way.
Code:
local ScreenGui = Instance.new(“ScreenGui”)
ScreenGui.Parent = game.Players.LocalPlayer.PlayerGui

local SliderFrame = Instance.new(“Frame”)
SliderFrame.Parent = ScreenGui
SliderFrame.Size = UDim2.new(0, 250, 0, 30)
SliderFrame.Position = UDim2.new(0.5, -125, 0.5, -15)
SliderFrame.BackgroundTransparency = 1

local SliderBar = Instance.new(“Frame”)
SliderBar.Parent = SliderFrame
SliderBar.Size = UDim2.new(1, 0, 1, 0)
SliderBar.BackgroundColor3 = Color3.fromRGB(164, 164, 164)
SliderBar.BackgroundTransparency = 0.5
SliderBar.BorderSizePixel = 2
SliderBar.BorderColor3 = Color3.fromRGB(0, 0, 0)

local SliderBarSurfaceGui = Instance.new(“SurfaceGui”)
SliderBarSurfaceGui.Parent = SliderBar
SliderBarSurfaceGui.Face = “Right”

local SliderBarSurface = Instance.new(“Surface”)
SliderBarSurface.Parent = SliderBarSurfaceGui
SliderBarSurface.Size = Vector2.new(200, 20)

local SliderBarSurfaceImage = Instance.new(“ImageLabel”)
SliderBarSurfaceImage.Parent = SliderBarSurface
SliderBarSurfaceImage.Size = UDim2.new(1, 0, 1, 0)
SliderBarSurfaceImage.Position = UDim2.new(0, 0, 0, 0)
SliderBarSurfaceImage.BackgroundTransparency = 1
SliderBarSurfaceImage.Image = “rbxassetid://439763732”

local SliderBarSurfaceImageFrame = Instance.new(“Frame”)
SliderBarSurfaceImageFrame.Parent = SliderBarSurfaceImage
SliderBarSurfaceImageFrame.Size = UDim2.new(1, 0, 1, 0)
SliderBarSurfaceImageFrame.Position = UDim2.new(0, 0, 0, 0)
SliderBarSurfaceImageFrame.BackgroundTransparency = 1

local SliderKnob = Instance.new(“ImageLabel”)
SliderKnob.Parent = SliderBarSurfaceImageFrame
SliderKnob.Size = UDim2.new(0, 15, 0, 30)
SliderKnob.Position = UDim2.new(0, 0, 0, 0)
SliderKnob.BackgroundTransparency = 1
SliderKnob.Image = “rbxassetid://439763921”

local SliderValue = Instance.new(“TextLabel”)
SliderValue.Parent = SliderFrame
SliderValue.Size = UDim2.new(0, 100, 0, 30)
SliderValue.Position = UDim2.new(0.5, -50, 0, 0)
SliderValue.BackgroundTransparency = 1
SliderValue.Text = “0”
SliderValue.Font = Enum.Font.Arial
SliderValue.FontSize = Enum.FontSize.Size18
SliderValue.TextScaled = true
SliderValue.TextColor3 = Color3.fromRGB(0, 0, 0)

local SliderMin = Instance.new(“TextLabel”)
SliderMin.Parent = SliderFrame
SliderMin.Size = UDim2.new(0, 20, 0, 30)
SliderMin.Position = UDim2.new(0, 0, 0, 0)
SliderMin.BackgroundTransparency = 1
SliderMin.Text = “0”
SliderMin.Font = En

Not sure why, but there’s tons of mistakes it shows apparently, even when I add the same stuff.