My remote event is not firing, but one is, help?

Hey all, I have this script that just updates a gui if a player dies, it checks what team they are on. It did work before, but I realised that I need for it to check in case a spectator resets.
Basically all it does it checks how much people are in a team. Ive got the update event working, but when a person dies it does nothing, now this has two scrips because I don’t know which one of them is not working.

Edit: forgot to mention but no output errors
Edit 2: forgot to mention again, but just tried this:
For the serverscript, at

if player.Team == Teams{“Survivor”} then

I have tried using {}, [], and (). Nothing worked as in the script didn’t produce any output errors and didn’t work.

Client side, in startergui with “plrcount” as a child

local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("plrcount")
local remoteEventv = ReplicatedStorage:WaitForChild("update")
local text = script.plrcount.Frame.TextLabel

local function onTimerUpdate(value)
	print("died")
	script.ambient1:Play()
	wait(.2)
	print(value)
	text.TextColor3 = Color3.new(0, 0, 0)
	script.plrcount.Frame.TextLabel.Text = "Players Remaining: ".. value
	
	text.TextColor3 = Color3.new(0.568627, 0, 0)
	wait(.5)
	text.TextColor3 = Color3.new(0, 0, 0)
	wait(.5)
	text.TextColor3 = Color3.new(0.568627, 0, 0)
	wait(.5)
	text.TextColor3 = Color3.new(0, 0, 0)
	wait(.5)
	text.TextColor3 = Color3.new(0.568627, 0, 0)
	wait(.5)
	text.TextColor3 = Color3.new(0, 0, 0)
end

local function update(plrvalue)
	script.plrcount.Frame.TextLabel.Text = "Players Remaining: ".. plrvalue
end


remoteEvent.OnClientEvent:Connect(onTimerUpdate)
remoteEventv.OnClientEvent:Connect(update)

Server side, in serverscriptservice


local playersOnTeam = game:GetService("Teams")["Survivor"]:GetPlayers()
local numberPlayersOnTeam = #playersOnTeam
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("plrcount")
local remoteEventv = ReplicatedStorage:WaitForChild("update")

script.remain.Value = #playersOnTeam

local value = script.remain.Value
remoteEventv:FireAllClients(value)


game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			if player.Team == Teams{"Survivor"} then
				print("sir had died")
				script.remain.Value = script.remain.Value - 1 
				local value = script.remain.Value
				remoteEvent:FireAllClients(value)
			end
		end)
	end)
end)

Any help is great, thanks!


Have any errors been sent to the output as a result of running this script, it’s possible it has to due with… if player.Team == Teams{"Survivor"} then i’ve never seen anyone use that syntax to index a table.

do this instead

Teams["Survivor"] 

.

ah crap forgot to say that no output errors, thanks for reminding me

I tried that before this, the same thing happened

maybe try adding prints to see if its the remote problem or the code

Did this, and I think it is the

if player.Team == Teams(“Survivor”) then

Because I have a print after that and I never remember seeing that

try using TeamColor and see what happens

also use a string value or int value placed in the replicated storage as its much easier cuz you just have to change those value in the server which will automatically change for all cilents

How would I do that? I have a variable set up for the teams, would I use

Teams.Color --I know this does not work, I have already tried this

I rewrote the whole line somewhat,

if player.TeamColor == BrickColor.Blue() then

Used this, also changed the team color from teal (orignal color) to bright blue (as it said that it returned bright blue, and I failed to find “blue”) and it still didn’t work ¯_(ツ)_/¯

if player.TeamColor == BrickColor.new("YourTeamColorName") then

This also didn’t work, its stupid this didn’t even return an output error, sorry

like i said use a value or something instead of remote also make sure its not a BindableEvent cuz i always get mixed up with bindable and remotes

How would I do that? Sorry not really sure what you’re talking about

Im pretty sure team color isnt replicated so you should try a diffferent approch.

its like add a int value in replicated storage that changes following the player left in game then in local side you just say yougui.Text = tostring(game.ReplicatedStorage.IntValue)

Edit:you would have to change major part of the script

no it does cuz i have a rounds system ssrver side that uses team color i guess

1 Like

you dont update your players. run this everytime there is a new round. also players may leave and u need to watch for that.

i have no idea how to do that,

lemme show you my rounds script

1 Like