I made a simple run and walk GUI but it isn't working and it's giving me an error at this colon: MouseButton1Click:Connect
This is the error: Players.xKhaIeesi.PlayerGui.WalkRunGUI.Frame.Run.RunScript:1: function arguments expected near ':'
Here's the run script:
script.Parent:MouseButton1Click:Connect(function() game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 64 end)
and here's the walk script:
script.Parent:MouseButton1Click:Connect(function() game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16 end)
Thanks
If I were you I would make this connected to a remote event instead because this script wouldn't work in game with filter enabled but here's the working version anyway
script.Parent.MouseButton1Click:Connect(function() game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16 end)
The problem is that you indexed the MouseButton1Click
event as if you were invoking a method. You're supposed to use periods .
for events, because colons :
are the syntax for calling functions.
Moreover;
script.Parent.MouseButton1Click:Connect(function() --code end)