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

hmmm i have this weird problem my script is not working on game i need help!?

Asked by 6 years ago
Edited 6 years ago

hmm here is the lua please help script about run/walk gui


player = script.Parent.Parent.Parent.Parent bin = script.Parent function mb1d() if (bin.Text == "Walk") then bin.Text = "Sprint" player.Character.Humanoid.WalkSpeed = 16 else bin.Text = "Walk" player.Character.Humanoid.WalkSpeed = 50 end end bin.MouseButton1Down:connect(mb1d)

1 answer

Log in to vote
-1
Answered by
JellyYn 70
6 years ago

do bin.MouseButton1Click:Connect(function() instead of using just a function Name()

I would provide a script, but I don't have studio opened, so I wouldn't know if it works. What I would do though, is something like this: make sure it is in a LocalScript in the "bin" (make sure bin is a TextButton or ImageButton)

local player = game.Players.LocalPlayer
local bin = script.Parent
run = false

bin.MouseButton1Click:Connect(function()
    if run == false then
        player.Character.Humanoid.WalkSpeed = 50
        run = true
        bin.Text = "Walk"
    elseif run == true then
        player.Character.Humanoid.WalkSpeed = 16
        run = false
        bin.Text = "Sprint"
    end
end)

This make it so when you are running, the text says walk, and running is true (a debounce). When you are walking ,the button says "Sprint." Hope this works, and if not, show me your new script with any errors in the Output.

0
Why was this downvoted? It should work. Please tell me why whoever did this, downvoted my script. You could just say it doesn't work and show me your script JellyYn 70 — 6y
Ad

Answer this question