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

My shop is working, but the items I'm purchasing are not. How do i fix that?

Asked by 4 years ago

I made a shop that works. It takes your money and gives you an item, but the item doesn't work. (the item works when I use it without buying in shop)

This is the code: (i got it from a youtube tutorial) Zims is my money

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function(click)
    if player.leaderstats.Zims.Value >= 10 then
        player.leaderstats.Zims.Value = player.leaderstats.Zims.Value - 10

        game.ReplicatedStorage.Tools.Sword:Clone().Parent = player:WaitForChild("Backpack")
    end
end)

Thanks for helping!

0
its local script? tracer_r 19 — 4y
0
yes loner_cactus 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
    if player.leaderstats.Zims.Value >= 10 then
        player.leaderstats.Zims.Value = player.leaderstats.Zims.Value - 10
        game.ServerStorage.Tools.Sword:Clone().Parent = Players.LocalPlayer.Backpack
    end
end)

try it

0
First of all, thank you for helping. It worked once but now the sword is not appearing in the backpack at all. loner_cactus 0 — 4y
Ad

Answer this question