So I have this remoteevent firing to the client when the game is finished:
ReplicatedStorage.TerminalRemotes.TWin.OnClientEvent:Connect(function()
if Players.LocalPlayer.Team == Teams.Terrorists then
print('playing win sound')
script.TWin:Play()
elseif Players.LocalPlayer.Team == Teams["Counter Terrorists"] then
script.CTLose:Play()
end
end)
I have confirmed that it does infact fire, but the script itself doesnt run properly? Can someone give me some insight please? (Its a local script)
Possibility 1: You made a typo and it was supposed to be ReplicatedStorage.TerminalRemotes.Twin.
Possibility 2: The player isn’t on the team Terrorists or Counter Terrorists.
Possibility 3: You made something wrong on the server.
Possibility 4: Even though it’s unlikely that there’s something wrong with teams, I usually compare the TeamColors instead of the Team objects.
It does make a successful communication, which is why it confuses me.
This is what the server action is:
if enPoints >= MAX_POINTS then
for i, v in pairs(game.Players:GetChildren()) do
if v:IsA("Player") then
local player = v
v.Team = game.Teams.Lobby
ReplicatedStorage.TerminalRemotes.TWin:FireClient(player)
print('fired terrorist win')
wait(1)
v:LoadCharacter()
end
end
ReplicatedStorage.TerminalRemotes.Notify:FireAllClients("Large", "THE " .. TEAMS.enemy.Name:upper() .. " HAS WON THE RAID")
stopRaid()
end
The player is on either team as well.
EDIT: It’s good to note that everything in this action does work and play properly.
First of, you’re making a little mistake here. The first argument when calling the :FireAllClients function needs to be the player. Are there any errors at all?