I have this script that checks for certain conditions and then fires an event to all clients

local repStorage = game:GetService("ReplicatedStorage")
local event = repStorage:WaitForChild("RedDead") 

game.Players.PlayerAdded:connect(function(plr)
	local client = game.Players.LocalPlayer
    plr.CharacterAdded:connect(function(chr)
        chr:WaitForChild("Humanoid").Died:connect(function()
			print('Boss Died')
         	if plr.TeamColor == BrickColor.new("Bright red") then
				game.ServerScriptService.Game.Disabled = true			
				for i, v in pairs(game.Players:GetChildren()) do
					if v.TeamColor == BrickColor.new('Bright red') then
						v.TeamColor = BrickColor.new("Bright yellow")
					end
					v.Character.Humanoid:UnequipTools()
					if v.Character.Humanoid ~= nil then
						v.Character:BreakJoints()
					end
				end	
				event:FireAllClients() --FIRE TO ALL CLIENTS
			end 
        end)
    end)
end)

I have this LocalScript in StarterGui

local repStorage = game:GetService("ReplicatedStorage")
local event = repStorage:WaitForChild("RedDead") 
local player = game.Players.LocalPlayer
local event2 = repStorage:WaitForChild("RedDeadFinished") 

event.OnClientEvent:connect(function()
	local screengui9 = Instance.new('ScreenGui', player.PlayerGui) 
	screengui9.Name = "playercheckgui9"
	-- Create textLabel
	local textLabel9 = Instance.new('TextLabel', player.PlayerGui.playercheckgui9)
	textLabel9.Position = UDim2.new(0.45, 0, 0.4, 0)
	textLabel9.Size = UDim2.new(0, 250, 0, 100)
	textLabel9.FontSize = "Size28"
	textLabel9.BackgroundTransparency = "1"
	textLabel9.TextStrokeTransparency = "0"	
	textLabel9.Text = ("Red has died!")
	for i=1, 50 do 
		textLabel9.TextColor3 = Color3.new(math.random(), math.random(), math.random())
		wait(0.1)
	end
wait(3)
	
	player.PlayerGui.playercheckgui9:Destroy()	
	event2:FireServer()

end)

Then I have another script that will fire when called, as can be seen above, event2:FireServer()

local repStorage = game:GetService("ReplicatedStorage")
local event2 = repStorage:WaitForChild("RedDeadFinished") 

event2.OnServerEvent:connect(function(player)	
	game.ServerScriptService.Game.Disabled = false	
end)

Now, ALL OF THIS WORKS AS IT SHOULD JUST FINE, BUT ONLY ONE TIME. After the players get reset, only the first script will run and only up to line 19. The line

event:FireAllClients() --FIRE TO ALL CLIENTS

does not run.

4 comments

0

Edited to fix code blocks.

0
  1. You're setting float values to strings. 2. LocalPlayer can ONLY be used in a LocalScript, either than or you're attempting to FireClients in a LocalScript which can not be done. 3. You haven't exactly explained your problem or attempted to narrow down the problem.
0

@M39a9am3R that line that has "local client = game.Players.LocalPlayer" is not in use in the script, It got left in there from when I had copied this from another one of my scripts. It is not in use by the script. I thought I was thorough enough? Essentially, after the player resets, the very first script in OP above, runs, except for the "event:FireAllClients()" line

0

Any errors?