Hello, There is a health value, whenever you touch a spike it lowers for 1. I have this script(Serverscript):
while test == true do wait() if health.Value < 2 then event1:FireAllClients() test = false end end
If on line 3 I do a print("something") It prints it once, everything is fine, but if I do remoteEvent it doesn't work... Local script:
event1.OnClientEvent:Connect(function() script.Parent.Parent.health1.Visible = false end)
Thank you.
Also here is the full script:
local event = game:GetService("ReplicatedStorage").Health local event1 = game:GetService("ReplicatedStorage").Health1 local test = true local debounce = false game.Players.PlayerAdded:Connect(function(player) local health = Instance.new("IntValue", player) health.Name = "Health" health.Value = 3 for i,v in pairs(workspace.Spikes:GetChildren()) do v.Touched:Connect(function() if not debounce then debounce = true health.Value = health.Value - 1 wait(5) debounce = false end end) end repeat wait() if health.Value < 3 then event:FireAllClients() end until health.Value < 3 while test == true do wait() if health.Value < 2 then event1:FireAllClients() test = false end end end)
And a picture of the explorer https://prnt.sc/rqa8ky