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

Does anybody know the script for 1 part to be taken before the other?

Asked by 6 years ago
Edited 6 years ago

I'm trying to get a part to be taken before the other.(one on top of the other) I need a script that makes me take the top one before the bottom one. this script makes e get 1 coin for a block. I need a script that takes the top one before the bottom. mabey a wait until or something? Script:

script.Parent.Touched:connect(function(part)
    if game.Players:findFirstChild(part.Parent.Name) then
        local plr = game.Players:findFirstChild(part.Parent.Name)
        plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 1
    end
end)
local debounce = true
script.Parent.Touched:connect(function(part)
    if debounce then
        debounce = false
        if game.Players:findFirstChild(part.Parent.Name) then
            local plr = game.Players:findFirstChild(part.Parent.Name)
            plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value
+1
            script.Parent:destroy()
        end
    end
end)

Answer this question