Ad
Log in to vote
1

Simple Run/Walk GUI giving error at colon?

Asked by 4 days ago

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

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

2 answers

Log in to vote
0
Answered by 4 days ago

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)
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. iiMayk 279 — 4d
0
Ah you're right wasn't thinking about all those silly exploiters...as for not explaining sorry I was a bit rushed Vulkarin 17 — 4d
Ad
Log in to vote
0
Answered by
Goulstem 7591 Administrator Badge of Merit
4 days ago
Edited 4 days ago

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)

Answer this question



Ad