local owner = script.Parent.Parent.Owner
local function OnClick (Player)
local HaveTeam = Player:FindFirstChild("HaveTeam")
if Player ~= nil then
if HaveTeam.Value ~= true then
Player.HaveTeam.Value = true
owner.Value = Player.Name
local team = Instance.new("Team")
team.Name = owner.Value.."'s Tycoon"
team.TeamColor = BrickColor.new("Bright red")
team.Parent = game:GetService("Teams")
Player.Team.TeamColor = BrickColor.new("Bright red")
script.Parent.Parent.Mine.Button.Script.Disabled = false
script.Parent:Destroy()
end
end
end
script.Parent.ClickDetector.MouseClick:Connect(OnClick)
Error is in line 13 Workspace.Sample.TeamChanger.Script:13: attempt to index field 'Team' (a nil value)

1 comment
Thank you