Hello! So i was making an textbutton for change player’s team, problem is that is not working, here’s the script witch i’ve made:
local textButton = script.Parent
local teamName = "TeamName" --sample team name.
local function changeTeam()
local player = game.Players:GetPlayerFromCharacter(textButton.Parent)
local team = game.Teams:FindFirstChild(teamName)
if player and team then
player.Team = team
end
end
textButton.MouseButton1Click:Connect(changeTeam)
Here’s an explorer screenshot too:
So, “jobs” is the button (imagebutton) and “script” is where it’s located the shared script from before. If someone could help me out on these, I would really apreciate it!
Check the console for any errors, we need to know what the script is doing to debug it. Also @yoshicoolTV is probably right in that it won’t get the player
(I suggest using a RemoteEvent and a single script in ServerScriptService, it makes this a bit easier to do)