I was making a team change system for my group’s game, and I got an unexpected error during testing. “Expected Team got Player for Player:Team.”
RemoteEvent in a folder in ReplicatedStorage
LocalScript in the team change Gui
Script in a folder in ServerScriptService
This is probably an easy fix, please tell me what I did wrong with my code.
LocalScript that send an event on player click
local event = game.ReplicatedStorage.Remotes.ChangeTeam local team = game.Teams.Immigrants local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() event:FireServer(player, team) end)
Script that receives the event and changes the player’s team
game.ReplicatedStorage.Remotes.ChangeTeam.OnServerEvent:Connect(function(player, team) player.Team = team end)
Note: The error occurs right after the event is sent and Studio says the error is in the server script.