So i’m working on a “pick up trash” game that’s similar to a simulator. But currently i’m stuck trying to get the pick up system working.
The Problem: You pick it up and earn a point(good), but then after the piece of trash respawns you’re no longer able to get points from it.
game.Players.PlayerAdded:Connect(function(player)
local debounce = true
script.Parent.Touched:connect(function()
local plr = player.leaderstats.Plastic
if debounce then
debounce = false
plr.Value = plr.Value +1
wait(2)
debounce = true
end
end)
end)
local wp = script.Parent
local toggle = false
wp.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil and not toggle then
toggle = true
local wpClone = wp:Clone()
wp:Destroy()
wait(10)
wpClone.Parent = workspace
toggle = false
end
end)
This is the regular script i’m working with, and it sets the new clone to a parent(or is supposed to) but it doesn’t give a point after the respawn. Can I get some help?
Well start putting print statements before and after where you think the problem is going on and also, dont put math.randomseed inside of the touched function but it outside like where youd put variables