This script gives me one coin when I touch it. I want to make another script that makes 1 part (part1) be taken after part2. is there a script for that? Mabe a wait until 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)
Try using a "Key":
-- it is a script inside workspace -- I recommend you make the coin with CanCollide false. local p = workspace.Coin local p2 = workspace.Locked p.Touched:Connect(function(plr) if plr.Parent.Humanoid then -- to be sure if a player touched this. local Permission = Instance.new("BoolValue", plr.Parent) -- We can create a permission here. Permission.Name = "Permission" Permission.Value = true -- You Can Add your Coin Script here too p:Destroy() end end) p2.Touched:Connect(function(plr) if plr.Parent.Permission and plr.Parent.Humanoid then -- to be sure if a player touched this print("You can get this part") p2:Destroy() end end)