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

instance.new("Team") if player.name == (name) then player.Team = (teamName)?/

player = game.Players.LocalPlayer

Team = Instance.new("Team")

Team.Name = "Owner"
Team.AutoAssignable = false
Team.TeamColor = BrickColor.Red()
Team.Parent = game.Teams

if player.Name == "VIImansxryVII" then
	player.Team = game.Teams("Owner")
end

why this script isn't working ?

the team is there but i dont gettin' moved to the team

(Workspace.VIImansxryVII.Dev Script:10: attempt to index nil with 'Name')

4 comments

0

Is this put in a local script?

0

no its normal script

0

You can't access LocalPlayer from a serverside script, you can only get LocalPlayer from a local script. Try using the PlayerAdded event

0

thank you too was offline a while

1 answer

✓ Accepted answer

I assumed this is answered but here it is anyways:

local Players = game:GetService('Players") 
local Teams = game:GetService("Teams") 


Players.PlayerAdded:Connect(function(player) 
If player.Name == ("yourname") then

local newTeam = Instance.new("Team")
newTeam.Name = "Owner"
newTeam.AutoAssignable = false
newTeam.TeamColor = BrickColor.Red()
newTeam.Parent = Teams

player.Team = Teams.Owner

end
end) 

Hopefully this works

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