A very simple question, almost the entirety of the two scripts are working but I'm not sure what I am supposed to do to change the players team, a local script in an ImageButton is triggering a RemoveEvent containing the players name and team they want to change to, this all works just fine, but I can't figure out how to then change the player to the team that is taken from the RemoveEvent as "Button".
Local GUI script:
local Button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("ChangeTeam")
Button.MouseEnter:Connect(function()
print("Entered")
Button.ImageColor3 = Color3.new(255, 255, 255)
end)
Button.MouseLeave:Connect(function()
print("Left")
Button.ImageColor3 = Color3.new(0.72549, 0.72549, 0.72549)
end)
local function onButtonActivated()
print("Button activated!")
RemoteEvent:FireServer(Button)
end
Button.Activated:Connect(onButtonActivated)
ServerScriptService script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:FindFirstChild("ChangeTeam")
local Teams = game:GetService("Teams")
local function Change(player, Button)
print(Button)
print(player)
player.Team = -- Not sure what is supposed to go here to change the player to the required team
end
RemoteEvent.OnServerEvent:Connect(Change)
Could someone tell me what to put on the 3rd last line? Thanks!
