Alright so I made a gun buying GUI for a street dealer and it won't buy the gun or take the money away due to the error aforesaid in the title.
local player = game:GetService("Players").LocalPlayer local money = player:WaitForChild("Money") function BuyAK() if money.Value >= 125 then money.Value = money.Value - 125 local AK47 = game.ServerStorage.AK47:clone() AK47.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack script.Parent.Text = "Gun Purchased" wait(5) script.Parent.Text = "Buy AK-47" else script.Parent.Text = "Purchase Failed" wait(5) script.Parent.Text = "Buy AK-47" end end script.Parent.MouseButton1Down:connect(BuyAK())
Right, so what I think is happening is the script is being executed before the LocalPlayer property is loaded. To fix it just wait for LocalPlayer to be occupied, put this at the start of your script:
repeat wait() until game.Players.LocalPlayer~=nil