Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

i have error:attempt to index nil with ''WaitForChild?

i want to make shop but this error messes up everything. Help PLS!!!!

script.Parent.MouseButton1Click:connect(function() local RS = game:GetService("ReplicatedStorage") local item = RS:WaitForChild("Stick") local price = 10 -- Change Your Price Here local player = game.Players.LocalPlayer local stats = player:WaitForChild("leaderstats")

if stats.Money.Value >= price then -- Change the Money to your Currency Name stats.Money.Value = stats.Money.Value - price local cloned = item:Clone() local cloned = item:Clone() cloned.Parent = player.Backpack cloned.Parent = player.StarterGear end end)

local stats = player:WaitForChild("leaderstats") it is line with error

1 comment

0

Next time, present your code in codeblocks.

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.