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.
1 comment
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