Why the script runs even if the bool value is false?

I have a problem that this script does still run even tho the bool value is false the script still runs.
It doesn’t show any errors.

runService.RenderStepped:Connect(function()	
	local plr = game.Players.LocalPlayer
	local character = plr.Character or plr.CharacterAdded:Wait()
	ServerEvent:FireServer()	
	local Hum = character:FindFirstChildOfClass("Humanoid")
	if Hum.MoveDirection.Magnitude > 0 and Hum.WalkSpeed > 0 then
-- it breaks here
		if script.Parent:FindFirstChild("Status").BoolValue.Value ~=  false then
			print("Moved")
			game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)		
		end
	end
end)
1 Like

Does it error at all? Why use ~= false when you could just do == true? You might even just be able to do .Value, not sure if that would only check if it exists or not.

There are a couple of other bits:

Firing a remote every frame is going to cause memory issues.

Why are you setting a core GUI enabled every frame?




If you’re trying to detect if the character is moving or not, you can utilise the StateChanged event.

2 Likes

Not moving or not, nothing at all. No errors. I tried the other way to check if the value is false or true, nothing worked. It still refreshes the backpack even if the value is false.

1 Like

do print(script.Parent:FindFirstChild(“Status”).BoolValue.Value) to debug to see if it even works

2 Likes

I don’t see anywhere you’re disabling the backpack core GUI. That could be the problem as well.

Did you try to optimise at all? What is this script for?

2 Likes

The script is to enable the backpack after player moved. I made it so if you stay idle while spawned then it won’t delete the ff and hide backpack.

1 Like

I think I see. The script doesn’t see that it changed, even if it did in explorer and a server script. That script what I showed is a client one.

1 Like

What script is changing the value of the bool?

Also, you can use Humanoid.StateChanged event to make this more efficient and save memory.

1 Like

The changing value script is on event from “zoneplus” (server script).

Are both scripts referencing the same value? Because if the server updates a value it should replicate to the client.

1 Like

It does in explorer (client explorer I don’t know how to call it).

Can you send a screenshot of the explorer, the server script that edits the value, and the full client script? The issue may lie somewhere else.

1 Like

that was the full client script, here is the server script:


zone.playerEntered:Connect(function(player)
-- rest of the script, creating the ff
	char.Status.CanRunAntiCamp.Value = false
end)

zone.playerExited:Connect(function(player)
-- script deleting the ff
	character.Status.CanRunAntiCamp.Value = true
end)


heres the video of the bool actually changing in the explorer/properties.

In the output still says that it is true.

in the post it checked BoolValue Value
and in the video the name is CanRunAntiCamp
maybe this is the issue?
if script.Parent:FindFirstChild("Status").CanRunAntiCamp.Value == true then

1 Like

I just changed the bool’s name, in every script too to be more clear what it does.

But I still think that the script is just not updating the actual value. If it is true then I have no idea how to really make it.

It says “~=” in the if statement. Is that intended?

1 Like

I tried to do both, == and ~=. Nothing works. It’s most likely to be the script’s fault due to it not trying to get the new value.

Try playing the game, and running this line in the command bar:

game:GetService("Players").LocalPlayer.Character.CanRunAntiCamp:GetPropertyChangedSignal("Value"):Connect(function() print("it changed") end)

and let me know if it is registers the change. If not, I don’t know what might be making it not work. You could try using a RemoteEvent on the server to tell the client to update it.

Also, where is this script located? Is it a Script or a LocalScript?

1 Like

Is the Value parented to the script, it needs to be a sibling of it (parented to the same thing that script is).

1 Like