Ok so I have a localscript which contains a for loop that checks if a bool value is false and does something if the bool value is false
However the bool value gets set to false on the server and the check is on the client.
for some odd reason when I set the bool value to false on the server (I print it and it actually sets to false) its still considered true on the client (printing the value and it stays true for some reason)
I’ve done some debugging and
the for loop works
the value sets to false on the server
value stays true on client (its not getting set to true again either)
SERVER SCRIPT: (remote event)
Variable: (char = plr.Character)
local attacking = char.attacking
attacking.Value = false
the actual loop check (CLIENT SCRIPT)
for i = 1,40 do
if not attacking.Value then
setattack = false
Variable on the client script is just
local attacking = script.Parent.Parent:WaitForChild("attacking")
That doesn’t really make sense. If you change something on the server it will change on the client as well. Is it just that the value isn’t printing that it hasn’t changed, or? Have you tried checking if the value is changing via the instance in workspace?
If anyone else comes along able to help here is a run down.
Attacking originally gets set to true on the client.
then the client checks to see if attacking gets set to false with a for loop.
the servers sets attacking to false
the client fails to detect it as the value is still true on the client for some reason.
I found the solution.
if you set a value to false while its false it literally does nothing.
since the value is set to true on the client its false on the server
so when I set it to false on the server it detects it as already false and does nothing.
since it does nothing it doesnt replicate to the client.
all I had to do was set it to true before I set it to false.
Thx for all of the help though!