Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

attempt to index a nil value?

Asked by 5 years ago
Edited 5 years ago
15:39:36.174 - Players.MrBong011.PlayerGui.Msg.ShopUI.ShopFrame.Template.Base.Purchase.TextButton.Script:9: attempt to index a nil value
15:39:36.175 - Stack Begin
15:39:36.176 - Script 'Players.MrBong011.PlayerGui.Msg.ShopUI.ShopFrame.Template.Base.Purchase.TextButton.Script', Line 9
15:39:36.176 - Stack End
repeat wait() until script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name ~= "Head"
Debounce = false

Player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent
Price = script.Parent.Parent.Parent:FindFirstChild("PriceValue")
Gun = script.Parent.Parent.Parent.Parent:FindFirstChild("Gun")

script.Parent.MouseButton1Click:connect(function()
    if Debounce == false and Player.Character:FindFirstChild("Money").Value >= Price.Value then
    Player.Character:FindFirstChild("Money").Value = Player.Character:FindFirstChild("Money").Value - Price.Value   
    wait()
    game.ServerStorage.Weapons:FindFirstChild(Gun.Text):clone().Parent = Player.Backpack
    end

end)

0
Why is line 1 so ridiculously long? Same for lines 4-6. Why so many script.Parent’s? User#19524 175 — 5y
0
idk mrbong011 -5 — 5y
0
Either Player.Character.Money or script.Parent.Parent.Parent.PriceValue does not exist. Scarious 243 — 5y
0
lord have mercy O_o. Mind putting the first bit in a code block as well? T0XN 276 — 5y
0
np mrbong011 -5 — 5y

Answer this question