BoolValue Update not being picked up

Alright, for my hit detection I have a few variables to be checked for the hit to process, for one of them I have a BoolValue inside the Player’s Character to check whether the character is ‘Blocking’ or not. When a server starts, the BoolValue’s Value is only picked upon from what it started as, e.g If I set it as false before i start up a server, the script will only pick it up being false, no matter whether i change it or not whilst ingame.
Here’s the hit detection lines:

Blade.Touched:Connect(function(Hit)
      if Hit.Parent:FindFirstChild("Humanoid") and Swinging == true and Hit.Parent.PlayerBlocking.Value == false and Hit.Parent:FindFirstChild("Humanoid").Health > 0 then
		Hit.Parent.Humanoid:TakeDamage(30)
		Swinging = false
		 end
	     if Blade.Transparency == 0 then
	     Hilt.Clash.ParticleEmitter.Enabled = true
		 Blade.Hit:Play()
		 end
	     wait(0.4)
		Hilt.Clash.ParticleEmitter.Enabled = false
		
end)

When the Value is set to true, the player shouldn’t be taking damage which works however if i set the value to true whilst ingame then the script still picks it up as being set to false. No errors or warnings are present in the output/console so I’ve got no idea why it’s not updating.
How could I get pass this bug?

Not a bug.

Did you by any chance happen to change the value in game through the properties tab without switching to server-mode?

I’m assuming that’s a server-script- values changed locally won’t trigger the Changed event on the server.

Edit:

Change it on the server instead then,


this should show ‘Server’, so that when you change the value, it replicates to the server and the Changed event can fire.

Oh damn, been using studio for atleast 8 years now and I never knew that was a thing, as stupid as I sound, thank you lmao.

1 Like