Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local Portal = script.Parent
- local PlaceToBeTeleported = Portal.PlaceToBeTeleported
- local function Debounce(Function)
- local IsRunning = false
- return function(Hit)
- if not IsRunning then
- IsRunning = true
- Function(Hit)
- IsRunning = false
- end
- end
- end
- Portal.Touched:Connect(Debounce(function(Hit)
- local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
- if Humanoid then
- local Character = Hit.Parent
- local Player = Players:GetPlayerFromCharacter(Character)
- if Player then
- local RebirthsValue = Player:WaitForChild("leaderstats"):WaitForChild("Rebirth")
- if RebirthsValue.Value >= Portal.RebirthsRequired.Value then
- Character:PivotTo(PlaceToBeTeleported.CFrame)
- end
- end
- end
- end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement