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

Simple Run/Walk GUI giving error at colon?

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

2 answers

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)

2 comments

1

Actually, LocalScripts can change the Humanoid WalkSpeed even with FilteringEnabled. Your answer is correct though, you should've just given a little explanation on what you did to fix it.

0

Ah you're right wasn't thinking about all those silly exploiters...as for not explaining sorry I was a bit rushed

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)

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