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

My shop script wont work and no errors appeared in ouput. Why isn't the buy script working?

Asked by 4 years ago

I am helping [redacted XD] make a rockfeller street remix sorta thing and I was helping him with the shop, when I finally fixed all the errors and clicked the buy button, no errors came up and I didn't get the item. Script:

local clickdetector = script.Parent:WaitForChild("ClickDetector")
Item = game.ServerStorage.LightStick

clickdetector.MouseClick:Connect(function(player)
    if player.leaderstats["Meme Points"].Value < 5 then
        script:Clone()
        script:Destroy()
        wait(0.1)
    end
end)
clickdetector.MouseClick:Connect(function(player)
        if player.leaderstats["Meme Points"].Value >= 5 then
        player.leaderstats["Meme Points"].Value = player.leaderstats["Meme Points"].Value - 5
        Item:Clone()
        Item.Parent = player.Backpack
        end
end)

I don't know what the problem is but please help

0
I'm not sure myself but try adding a variable to "Item" on line 14. Might help. Try: local ClonedItem = Item:Clone()      ClonedItem.Parent ) player.Backpack noammao 294 — 4y
0
It could also be becuase the player has less than 5 points. The script would get cloned & destroyed. But since you never set the parent of the cloned script it would get completely deleted. Always a good idea to debug with "print()" noammao 294 — 4y

Answer this question