My script is:
script.Parent.MouseButton1Click:Connect(function()
local RS = game:GetService("ReplicatedStorage")
local item = RS:WaitForChild("Sword")
local price = 100
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
if stats.Money.value >= price then
stats.Money.value = stats.Money.value - price
local cloned = item:Clone()
local cloned2 = item:Clone()
cloned2.Parent = player.Backpack
cloned.Parent = player.StarterGear
end
end)
the whole error says:
Players.HamsterxDD.PlayerGui.ScreenGui.Frame.TextButton.Script:7: attempt to index nil with 'WaitForChild'
If anyone has a simple solution please tell me about it. I'm a beginner and i'm still practicing, any help will be appreciated.

3 comments
Is it a local script?
If you're using a normal script (not LocalScript,) it won't be accessible. Use a LocalScript.
when it's a localscript it only works on your screen. I'll find a different solution.