How would I go with making a slider (gui) that converts to TopParamB of a specific part?
1 Like
This should help. I added notes that’ll give you an understanding.
--get a reference to the part you want to modify
local part = workspace.Part1
-- Create a ScreenGUI object to hold the slider
local gui = Instance.new("ScreenGui")
gui.Parent = game.Players.LocalPlayer.PlayerGui
-- Create a frame to hold the slider
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 200, 0, 20)
frame.BackgroundTransparency = 0.5
frame.BackgroundColor3 = Color3.new(1, 1, 1)
frame.Position = UDim2.new(0.5, -100, 0.5, -10)
frame.Parent = gui
-- Create a UISlider object to represent the slider
local slider = Instance.new("UISlider")
slider.Size = UDim2.new(1, 0, 1, 0)
slider.Parent = frame
-- Add an event listener to the slider to update the Part1's TopParamB value whenever the slider's value changes
slider.Changed:Connect(function(newValue)
part.TopParamB = newValue
end)
2 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.