Script doesn't receive event

Ok so my problem is that

local RKBM = {" Slayed By ",
	" Snowballed By ",
	" Poisoned By ",
	" Oofed By ",
	" Flinged By ",
	" Yeeted By "
}
local Data = {	
	Text = ""; 
	Color = Color3.fromRGB(255, 255, 255);
	Font = Enum.Font.SourceSansBold; 
	TextSize = 18}
game.ReplicatedStorage.OnDeath.OnClientEvent:Connect(function(Killer,Killed)
	print("Message Recieved!")
	if Killed then
		Data.Text = Killer..RKBM[math.random(1,#RKBM)]..Killed
		print("Sending")
		game.StarterGui:SetCore("ChatMakeSystemMessage",Data)
		print("Sent")
	end
	print("A")
end)

this script in Starter character scripts dosent receive a message for some reason now i dont know why please help me the script that sends is this one

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		char:WaitForChild("Humanoid").Died:Connect(function()
			local Tag = plr.Character.Humanoid:FindFirstChild("creator")
			if Tag then
				print(Tag.."Is Not NIL!")
				game.ReplicatedStorage.OnDeath:FireAllClients(Tag.Value,plr.Character.Name)
			end
		end)

		local gui = script.Team:Clone()
		gui.Parent = plr.Character.Head
		while wait() do
			gui.Color.BackgroundColor3 = plr.TeamColor.Color
		end
	end)
end)

thanks you and i want to acheive is to get the client script to receive the message

Just to be clear, one of these scripts is a local script, right @Qinrir?

Is it not showing up because you’re respawning? Do the not-dead people get the message? Either way, since this LocalScript is dealing with CoreGuis which also don’t reset on death, you might consider moving the script to StarterPlayerScripts.

local RKBM = {" Slayed By ",
	" Snowballed By ",
	" Poisoned By ",
	" Oofed By ",
	" Flinged By ",
	" Yeeted By "
}

local Data = {	
	Text = ""; 
	Color = Color3.fromRGB(255, 255, 255);
	Font = Enum.Font.SourceSansBold; 
	TextSize = Enum.FontSize.Size18}

local starterGui = game:GetService("StarterGui")
local storage = game:GetService("ReplicatedStorage")
local deathRemote = storage:WaitForChild("OnDeath")

deathRemote.OnClientEvent:Connect(function(Killer, Killed)
	print("Message Recieved!")
	if Killed then
		Data.Text = Killer..RKBM[math.random(1, #RKBM)]..Killed
		print("Sending")
		starterGui:SetCore("ChatMakeSystemMessage", Data)
		print("Sent")
	end
	print("A")
end)
local players = game:GetService("Players")
local storage = game:GetService("ReplicatedStorage")
local deathRemote = storage:WaitForChild("OnDeath")
local gui = script:WaitForChild("Team")

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local humanoid = char:WaitForChild("Humanoid")
		humanoid.Died:Connect(function()
			local Tag = humanoid:FindFirstChild("creator")
			if Tag then
				print(Tag.."Is Not NIL!")
				deathRemote:FireAllClients(Tag.Value, char.Name)
			end
		end)
		
		local guiClone = gui:Clone()
		local head = char:WaitForChild("Head")
		guiClone.Parent = head
		--gui.Color.BackgroundColor3 = plr.TeamColor.Color --is color a child of gui?
	end)
end)

I’ve commented out a line of code which you should look at.

is the local script ok?


the line you commented out is for telling the players that from what team is a player from

i did but still nothing! idk why

Is “Color” a valid child of “gui”?

If it is then here:

local players = game:GetService("Players")
local storage = game:GetService("ReplicatedStorage")
local deathRemote = storage:WaitForChild("OnDeath")
local gui = script:WaitForChild("Team")

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local humanoid = char:WaitForChild("Humanoid")
		humanoid.Died:Connect(function()
			local Tag = humanoid:FindFirstChild("creator")
			if Tag then
				print(Tag.."Is Not NIL!")
				deathRemote:FireAllClients(Tag.Value, char.Name)
			end
		end)

		local guiClone = gui:Clone()
		local head = char:WaitForChild("Head")
		guiClone.Parent = head
		gui:WaitForChild("Color").BackgroundColor3 = plr.TeamColor.Color
	end)
end)

Fix for the other script:

yes it is the server script works fine its the local script also i am trying to fix it if it dosent get fixed ill tell you also thank you for telling me :slight_smile:

Thank you for your help i did tweak a bit here is the main server script:

local OnThrow = game.ReplicatedStorage.OnThrow
local db = false
OnThrow.OnServerEvent:Connect(function(Player, Pos, Speed,dmg,human2dmg)
	if not db then
		db = true
		local Part = script.Part:Clone()
		Part.Name = "Snowball"
		Part.Position = Player.Character.Head.Position
		Part.Part.Position = Player.Character.Head.Position
		Part.Parent = game.Workspace
		Part.Velocity = Pos.LookVector * Speed
		Part.Velocity = Pos.UpVector * -Speed/5
		if human2dmg~=nil then
			human2dmg.Health = human2dmg.Health - dmg*8
			print(human2dmg.Health)
			if human2dmg.Health == 0 then
				game.ReplicatedStorage.OnDeath:FireAllClients(Player.Name,human2dmg.Parent.Name)
				print(human2dmg.Parent.Name.." Was Killed By "..Player.Name)
			end
			human2dmg.Parent.HumanoidRootPart.Velocity = Pos.LookVector*Speed/4
		end
		Part.Part.BrickColor	 = Player.TeamColor
		wait(0.5)
		db = false
	end
end)

local script:

local RKBM = {" Slayed By ",
	" Was Snowballed By ",
	" Was Poisoned By ",
	" Was Oofed By ",
	" Was Flinged By ",
	" Was Yeeted By "
}
local Data = {	
	Text = ""; 
	Color = Color3.fromRGB(255, 255, 255);
	Font = Enum.Font.SourceSansBold; 
	TextSize = 18
}


local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")


local starterGui = game:GetService("StarterGui")
local storage = game:GetService("ReplicatedStorage")
local deathRemote = storage:WaitForChild("OnDeath")

deathRemote.OnClientEvent:Connect(function(Killer, Killed)
	print("Message Recieved!")
	if Killed then
		Data.Text = Killed..RKBM[math.random(1, #RKBM)]..Killer
		starterGui:SetCore("ChatMakeSystemMessage", Data)
	end
end)