Attempt to index local 'player' a nil value?
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.
01 | local player = game:GetService( "Players" ).LocalPlayer |
02 | local money = player:WaitForChild( "Money" ) |
05 | if money.Value > = 125 then |
06 | money.Value = money.Value - 125 |
07 | local AK 47 = game.ServerStorage.AK 47 :clone() |
08 | AK 47. Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack |
09 | script.Parent.Text = "Gun Purchased" |
11 | script.Parent.Text = "Buy AK-47" |
13 | script.Parent.Text = "Purchase Failed" |
15 | script.Parent.Text = "Buy AK-47" |
20 | script.Parent.MouseButton 1 Down:connect(BuyAK()) |