1
This commit is contained in:
commit
a85391509d
211 files changed
+28903
No files matched your search
@@ -0,0 +1,40 @@
|
||||
--!strict
|
||||
-- All lobby gateways lead to validated spawn points on the imported static arena.
|
||||
local Players = game:GetService("Players")
|
||||
local ArenaSpawns = require(script.Parent:WaitForChild("ArenaSpawns"))
|
||||
local lobby = workspace:WaitForChild("HunterLobby")
|
||||
local cooldown: {[Player]: boolean} = {}
|
||||
|
||||
local function teleport(hit: BasePart)
|
||||
local character = hit:FindFirstAncestorOfClass("Model")
|
||||
local player = character and Players:GetPlayerFromCharacter(character)
|
||||
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
|
||||
if not player or not character or not humanoid or humanoid.Health <= 0 or cooldown[player] then return end
|
||||
local destination = ArenaSpawns.choose(player)
|
||||
cooldown[player] = true
|
||||
player:SetAttribute("InArena", true)
|
||||
player.RespawnLocation = destination
|
||||
ArenaSpawns.place(character, destination)
|
||||
local backpack = player:FindFirstChildOfClass("Backpack")
|
||||
local tool = backpack and backpack:FindFirstChild("SniperRifle")
|
||||
if tool and tool:IsA("Tool") then humanoid:EquipTool(tool) end
|
||||
task.delay(1.5, function() cooldown[player] = nil end)
|
||||
end
|
||||
|
||||
for _, name in {"Arena Gateway_001", "Training Gateway_001", "Duel Gateway_001"} do
|
||||
local gateway = lobby:WaitForChild(name) :: Model
|
||||
local cf, size = gateway:GetBoundingBox()
|
||||
local trigger = Instance.new("Part")
|
||||
trigger.Name = name .. " Teleport Trigger"
|
||||
trigger.Size = Vector3.new(math.min(size.X - 4, 18), 5, math.min(size.Z - 4, 18))
|
||||
trigger.CFrame = CFrame.new(cf.Position.X, 2.5, cf.Position.Z)
|
||||
trigger.Transparency = 1
|
||||
trigger.Anchored = true
|
||||
trigger.CanCollide = false
|
||||
trigger.CanQuery = false
|
||||
trigger.CanTouch = true
|
||||
trigger.Parent = gateway
|
||||
trigger.Touched:Connect(teleport)
|
||||
end
|
||||
|
||||
Players.PlayerRemoving:Connect(function(player) cooldown[player] = nil end)
|
||||
Reference in new issue
Block a user