Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to insert auto delete in GUI slider? ( PLZ FAST )

Asked by 2 years ago

I need to know the answer to this question as soon as possible. Read carefully!!! Here is the code:

local UserInputService = game:GetService("UserInputService")
local Dragging = false
script.Parent.TextButton.MouseButton1Down:Connect(function()
    Dragging = true
end)

UserInputService.InputChanged:Connect(function()
    if Dragging then
        local MousePos = UserInputService:GetMouseLocation()+Vector2.new(0,36)
        local RelPos = MousePos-script.Parent.AbsolutePosition
        local Precent = math.clamp(RelPos.X/script.Parent.AbsoluteSize.X,0,1)
        script.Parent.TextButton.Position = UDim2.new(Precent,0,0.5,0)
--1
        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = Precent*100
--2
    end
end)

UserInputService.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        Dragging = false
    end
end)

I want a script instead of an element between 1 and 2, which after passing the GUI to the end removes the entire GUI. I tried to do it, but it failed. If you need to type a slider position, write "XYZ" .

1 answer

Log in to vote
0
Answered by 2 years ago

Do you want to Animate it or delete ?

If delete use this

Script.Parent:Destroy()

If animate use "TweenService"

Link : https://developer.roblox.com/en-us/api-reference/class/TweenService

And BTW Don't type ( PLZ FAST ) in the end. That wont change anything just makes you look like a kid :D

No offence, I wish I helped :D

Ad

Answer this question