Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Filtering enabled not working in team change scripts?

Asked by 6 years ago

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)
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)". maquilaque 136 — 6y
0
Not completely true maquilaque, 'player' will be send automaticly client - server User#20388 0 — 6y
0
So when I call the player it is called twice? so is there any point of calling the player? THEROBLOXAIN2 15 — 6y
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) User#20388 0 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

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

Ad

Answer this question