Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.