What i am trying to do is, when the player selects the red team, it changes the value of intValue teamPicked to 1, and stringValue of TEAM to "red", thank you.

local player = game.Players.LocalPlayer
local plr = script.Parent.Parent.Parent.Parent.Name
local teamPicked = player.playerInfo.teamPicked

script.Parent.MouseButton1Click:connect(function()
	game.Players[plr].Team = game.Teams.Red
	game.Players[plr].TeamColor = BrickColor.new("Bright red")
script.Parent.Parent.Enabled = false
teamPicked.Value = 1
game.ReplicatedStorage.TEAM = "red"
end)

3 comments

0

It is hard for me to see the code, next time use that lua button when typing a question but the issue is that playerInfo is nil, possible problems is that you can try :WaitForChild() or check if player info is in that player, if it is then it probably did not load/

0

please read this before you decide to post a question: https://scriptinghelpers.org/help/how-post-good-questions-answers

0

Can you give us any errors from the output menu?