What's wrong with this simple shop script?

local folder = game.ServerStorage:WaitForChild("Tools")
local tool = folder:WaitForChild("MedKit")
local price = 100
local plr = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if plr.leaderstats.Dinheiro.Value >= price then
		tool:Clone().Parent = plr.Backpack
	end
end)

This is a simple code i made for players to buy a tool in a gui button.

What’s wrong with it, because it’s not working and the output shows no error.

“Dinheiro” is the currency

1 Like

Is this a local script?
If so ServerStorage can’t be accessed.

Try using ReplicatedStorage instead.

3 Likes