I made a script to change a boolean value from false to true when the robux value was greater than or equal to 100. But im getting the error: 15:43:41.837 - Players.CarmiteStars.PlayerGui.Menu.MenuFrame.AdvancementOpener.AdvancementFrame.Adv2.Adv2Script:1: attempt to index field 'LocalPlayer' (a nil value)
while true do wait() local player = game.Players.LocalPlayer local robux = player:WaitForChild("stats"):FindFirstChild("robux") local adv1 = player:WaitForChild("adv"):FindFirstChild("adv1") if adv1 and robux then if robux.Value >= 100 then adv1.Value = true end end end
If you could explain that would be great.
Just had to change the script to a local script. Thanks commenters!
Its cause it a local script or if its a regular script then find the player some other way because. game.Players.LocalPlayer only works for local scripts. Also if u change a value for a localscript only scripts local to that player can see it