Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

event:FireAllClients() doesn't work for my script... Anyone could help me?

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.

7 comments

2

Make it print on the remote event function, and see if it prints.

0

What happen when the script run?

0

Yea, it prints. That means the problem is in the local script's line 2, but I dont get what's the problem :d

0

can you send me a picture of your explorer? include all the things mentioned in the script above

0

Yea, I could but I cant send any pictures here or at Roblox, Maybe u could give me your Discord?

0

Nvm it worked

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.