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

Filtering enabled not working in team change scripts?

Local script

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	player.TeamColor = BrickColor.new("Bright green")
	player.Character.Humanoid.Health = nil
    script.RemoteEvent:FireServer()
end)

script

script.Parent.OnServerEvent:Connect(function(player, TeamColor, Character)
    player.TeamColor = TeamColor
end)

4 comments

0

You forgot to put the variables in ":FireServer()", the function doesn't know who is the player, neither the TeamColor. You should put ":FireServer(player, player.TeamColor)".

0

Not completely true maquilaque, 'player' will be send automaticly client - server

0

So when I call the player it is called twice? so is there any point of calling the player?

0

If you go client -> server; you don't have to add player, this changes for server -> client (as you need to specify the player), but not for :FireAllClients (as it fires for all players)

1 answer

✓ Accepted answer

Hi Robloxian,

The reason your server script isn't firing is because the RemoteEvent is on the client, it needs to be in ReplicatedStorage. Also, the ServerScript needs to be in ServerScriptService or ServerStorage. And, you didn't send all the parameters you need to send through the :Fire() function. You need to send the teamcolor that you want it to become and I don't even know why you have used the Character as a parameter in that ServerScript.

##Hope I helped and have a wonderful day/night.

Thanks,

Best regards,

~~ KingLoneCat

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