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())

2 comments
Most of the time this error is generated because the Asker is using a Server Script rather than a Local Script for LocalPlayer.
Good point, didn't consider he could be using the wrong script type.