This commit is contained in:
listik committed 2026-11-29 15:49:17 +03:00
commit a85391509d
211 files changed
+28903

No files matched your search

@@ -0,0 +1,36 @@
--!strict
-- Initial spawn is in the lobby; players who entered a portal respawn in the arena.
local Players = game:GetService("Players")
local ArenaSpawns = require(script.Parent:WaitForChild("ArenaSpawns"))
local lobbySpawn = workspace:WaitForChild("HunterLobby"):WaitForChild("Arrival Spawn") :: SpawnLocation
local function onCharacterAdded(player: Player, character: Model)
local root = character:WaitForChild("HumanoidRootPart", 10)
local humanoid = character:WaitForChild("Humanoid", 10)
if not root or not humanoid or not humanoid:IsA("Humanoid") or player.Character ~= character then return end
local inArena = player:GetAttribute("InArena") == true
local destination = if inArena then ArenaSpawns.choose(player) else lobbySpawn
player.RespawnLocation = destination
ArenaSpawns.place(character, destination)
if inArena then
local backpack = player:WaitForChild("Backpack", 5)
local tool = backpack and backpack:WaitForChild("SniperRifle", 5)
if tool and tool:IsA("Tool") and player.Character == character and humanoid.Health > 0 then
humanoid:EquipTool(tool)
end
else
humanoid:UnequipTools()
end
end
local function onPlayerAdded(player: Player)
player:SetAttribute("InArena", false)
player.RespawnLocation = lobbySpawn
player.CharacterAdded:Connect(function(character)
onCharacterAdded(player, character)
end)
if player.Character then task.spawn(onCharacterAdded, player, player.Character) end
end
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do onPlayerAdded(player) end
@@ -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)