Hi devs i cannot seem to update this bool value can anyone help there is no error
local BO = Instance.new("BoolValue", game:GetService("ReplicatedStorage"))
BO.Name = "Bool"
local ev = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage"))
ev.Name = "PD"
local evd = Instance.new("RemoteEvent", game.ReplicatedStorage)
evd.Name = "HD"
ev.OnServerEvent:Connect(function()
print("catch")
if BO then
BO.Value = false
else
BO.Value = true
end
print(BO)
end)
evd.OnServerEvent:Connect(function(player)
print("somone died")
if BO then
wait(3)
print("Kicking " + player)
player:kick("You Died")
end
end)
do BO.Value for everything without the value like this:
local BO = Instance.new("BoolValue", game:GetService("ReplicatedStorage"))
BO.Name = "Bool"
local ev = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage"))
ev.Name = "PD"
local evd = Instance.new("RemoteEvent", game.ReplicatedStorage)
evd.Name = "HD"
ev.OnServerEvent:Connect(function()
print("catch")
if BO.Value then
BO.Value = false
else
BO.Value = true
end
print(BO.Value)
end)
evd.OnServerEvent:Connect(function(player)
print("somone died")
if BO.Value then
wait(3)
print("Kicking " + player)
player:kick("You Died")
end
end)
Also, there is a much more efficient way of changing it for the event with not
. Like this
ev.OnServerEvent:Connect(function()
print("catch")
BO.Value = not BO.Value
print(BO.Value)
end)