How can I teleport more than one person, but make it where each person has their own local debounce wait() ?
game.Players.PlayerAdded:connect(function(player) local bv1 = Instance.new("BoolValue", player) bv1 = false if game.Players.LocalPlayer:FindFirstChild("BoolValue") == nil then local bv = Instance.new("BoolValue", game.Players.LocalPlayer) bv = false end player.CharacterAdded:connect(function(chara) chara:WaitForChild("Humanoid").Died:connect(function() if chara:FindFirstChild("BoolValue") == nil then local bv = Instance.new("BoolValue", chara) bv = false end end) end) end)
teleporter
local part = script.Parent local Teleporter = part.Teleporter script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') and hit.parent:FindFirstChild("BoolValue") == false then local player = hit.Parent player.BoolValue = true player.HumanoidRootPart.CFrame = CFrame.new(Teleporter.Position) wait(2) player.BoolValue = false end end) Teleporter.Touched:connect(function(hit) --Old code but imagine debounce being the BoolValue if hit.Parent:FindFirstChild('Humanoid') and debounce == false then debounce = true wait(1) local player = hit1.Parent player.HumanoidRootPart.CFrame = CFrame.new(part.Position) wait(1.5) debounce = false end end)
Insert a BoolValue
inside a player. You can change its value to true or false and do your code. Basic set up for a bool value:
game:GetService("Players").PlayerAdded:Connect(function(plr) local debounce = Instance.new("BoolValue",plr) debounce.Name = "Debounce" debounce.Value = false end)