So I used the following code in a LocalScript (located in an ImageButton) to make a sprint button. When the
WalkSpeed is set to 16 (the default), I have an image of walking displayed on the ImageButton. When the button is clicked, the
WalkSpeed is changed to 64 and the code changes the image to running. However, when I click the button in game, my
WalkSpeed changes accordingly, but the image for my ImageButton won’t show up.
Here’s the code:
local clicked = false script.Parent.MouseButton1Click:Connect(function() if clicked then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 64 script.Parent.Image = "http://www.roblox.com/asset/?id=1488065691" -- The running image ID clicked = false else game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16 script.Parent.Image = "http://www.roblox.com/asset/?id=265205655" -- The walking image ID clicked = true end end)
I tried using a different running image ID, but either way it still wouldn’t load.
Any ideas as to what the error is? Thanks in advance!