I'm getting the nil value error message! Where have I gone wrong?

The specific error code I get is:
Players.Skiloopski.PlayerGui.GUI.Frame.TextButton.Script:2: attempt to index nil with ‘Team’

Can we see the code? We can’t really help you fix an error without seeing the code.

Mind showing your code or we cannot help you.

script.Parent.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.Team = game.Teams.Blue
game.Players.LocalPlayer.Neutral = false
end)

Is this in a regular script? If so, you can’t use a regular script. You must use a local script to access the LocalPlayer.

1 Like

Ok, I will try local script now.

It worked! Thanks! c: I will mark your reply as a solution.

1 Like

When it puts you on a team it doesn’t let you change! How can I fix this?