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 "blue", the error im getting is attempt to index nil with 'WaitForChild', ive also tried not using waitforchild and some other ways but it still did not work. I apologize if there is not enough information, but this is all i have so far:
local player = game.Players.LocalPlayer local plr = script.Parent.Parent.Parent.Parent.Name local playerInfo = game.Players.LocalPlayer:WaitForChild("playerInfo") --< local teamPicked = player.playerInfo:WaitForChild("teamPicked") script.Parent.MouseButton1Click:connect(function() game.Players[plr].Team = game.Teams.Blue game.Players[plr].TeamColor = BrickColor.new("Lapis") script.Parent.Parent.Enabled = false -- the whole screenGui teamPicked.Value = 1 -- intValue game.ReplicatedStorage.TEAM = "blue" -- this is a stringValue end)
the problem is in row 3
Just do. i don't think it would fix the problem but it might
local playerInfo = player:WaitForChild("playerInfo")
The playerInfo does not exist, check if it is there. This error means that you tried to do something to nil (nothing). Maybe the playerInfo is in character, find it's location and check again.
Characters automatically come with the .Archivable property off! All you need to fix is turn it on before doing the WaitForChild operation
Seems like i found out the problem myself, thanks for trying to help guys, appreciate the support!