Hi there,
I am making a trick or treat system for a Halloween event in a game I work on. I have the getting treats part finished, but I do not know how I would make the trick happen. For the trick it would just subtract your candy amount.
Script (so far):
local debounce = true
game.Players.PlayerAdded:Connect(function(player)
local LS = Instance.new(“Folder”)
LS.Name = “leaderstats”
LS.Parent = player
local candy = Instance.new("IntValue")
candy.Name = "Candy"
candy.Parent = LS
candy.Value = 0
end)
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if debounce == true then
debounce = false
print (player.Name)
script.Parent.DoorBell:Play()
wait(3)
local random = math.random(1, 5)
player.leaderstats.Candy.Value = player.leaderstats.Candy.Value + random
wait(60)
debounce = true
end
end)``