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.

3 comments
Local Script?
Have you tried local player = game.Players:WaitForChild("LocalPlayer")
@AltNature, Unless there is a player named "LocalPlayer", that wouldn't work. LocalPlayer should always exist because the PlayerObject itself is needed to run Local Scripts. The reason this doesn't work is probably because you used a server script rather than a local script.