Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

This if statement does not work properly? [Solved]

Asked by
Hypgnosis 186
5 years ago
Edited 5 years ago
if boolOne.Value and playerWhoClicked.Character.Humanoid.WalkSpeed == 0 then

print('Success')

end

I've checked and double checked that it works with just the boolOne.Value, so the problem is with checking the WalkSpeed. I'm also certain that my WalkSpeed == 0 because I went into my humanoid properties and checked it!

It's inside a MouseClick event of a ClickDetector, so playerWhoClicked is the paramater which gets the player.

There are no errors, so I'm pretty confused. Any help would be appreciated.

2
The issue is likely that you didn't change it from the server mode. Studio has the option to toggle between the server and client. User#24403 69 — 5y
2
1. is this a server script? 2. have u checked that the conditions arent actually being met? i know its probably a silly question, but you have nothing within the if statement, so im not sure Gey4Jesus69 2705 — 5y
0
Yes, it's a server script. I haven't actually included my current code inside. And yes, I've double checked that the conditions are properly met. Hypgnosis 186 — 5y
2
print(boolOne.Value) before this if statement and see what u get. then print the walkspeed too Gey4Jesus69 2705 — 5y
View all comments (6 more)
0
Okay, thanks for the suggestion. WalkSpeed is printing 16, even though I am looking at it being 0 in Player.Character.Humanoid Hypgnosis 186 — 5y
2
maybe you changed the walkspeed locally?? Gey4Jesus69 2705 — 5y
0
Yeah, that's exactly what I did. I don't know why I didn't think to do it on the server script. Hypgnosis 186 — 5y
2
glad i helped Gey4Jesus69 2705 — 5y
0
Thanks! Hypgnosis 186 — 5y
0
please mark title as [Solved] DinozCreates 1070 — 5y

Answer this question