debounce = false
script.Parent.Touched:Connect(function(hit)
if debounce == false then
debounce = true if hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr~=nil then if plr:FindFirstChild("Stats") and plr:FindFirstChild("Main") and plr.Main:FindFirstChild("CandysQ3") and plr.Stats:FindFirstChild("????Candys") and
plr.Main:FindFirstChild("BoostCandy") then
local coins = plr.Stats["????Candys"] local CandysQ3 = plr.Main["CandysQ3"] if plr:WaitForChild("Main").BoostCandy.Value == 0 then coins.Value = coins.Value + 1 CandysQ3.Value = CandysQ3.Value + 1 else coins.Value = coins.Value +
1+plr:WaitForChild("Main").BoostCandy.Value CandysQ3.Value = CandysQ3.Value + 1
end end end script.Parent:Destroy() end debounce = false end
end)
You did not create the coin so you would need to do:
debounce = true if hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr~=nil then if plr:FindFirstChild("Stats") and plr:FindFirstChild("Main") and plr.Main:FindFirstChild("CandysQ3") and plr.Stats:FindFirstChild("????Candys") and
plr.Main:FindFirstChild("BoostCandy") then
local coins = plr.Stats["????Candys"] local CandysQ3 = plr.Main["CandysQ3"] if plr:WaitForChild("Main").BoostCandy.Value == 0 then coins.Value = coins.Value + 1 CandysQ3.Value = CandysQ3.Value + 1 else coins.Value = coins.Value +
1+plr:WaitForChild("Main").BoostCandy.Value CandysQ3.Value = CandysQ3.Value + 1
end end end local coin_clone = script.Parent:Clone() coin_clone.CFrame = script.Parent.CFrame script.Parent:Destroy() end debounce = false end