23
This commit is contained in:
1 parent
11d5404f8f
commit
f073f06427
3 files changed
+28
-25
No files matched your search
@@ -158,10 +158,14 @@ local function clearTools(container: Instance?)
|
||||
end
|
||||
|
||||
local function guardInventory(player: Player, container: Instance)
|
||||
local function disarmed(): boolean
|
||||
return player:GetAttribute("InArena") ~= true or player:GetAttribute("ArenaWaiting") == true
|
||||
or player:GetAttribute("ArenaIntermission") == true
|
||||
end
|
||||
container.ChildAdded:Connect(function(child)
|
||||
if player:GetAttribute("InArena") ~= true and child:IsA("Tool") then child:Destroy() end
|
||||
if child:IsA("Tool") and disarmed() then child:Destroy() end
|
||||
end)
|
||||
if player:GetAttribute("InArena") ~= true then clearTools(container) end
|
||||
if disarmed() then clearTools(container) end
|
||||
end
|
||||
|
||||
local function resetStreak(player: Player)
|
||||
@@ -190,12 +194,6 @@ local function moveToLobby(player: Player)
|
||||
end
|
||||
end
|
||||
|
||||
local function bench(player: Player)
|
||||
if not roster[player] then return end
|
||||
player:SetAttribute("ArenaWaiting", true)
|
||||
moveToLobby(player)
|
||||
end
|
||||
|
||||
local function sendToLobby(player: Player)
|
||||
roster[player] = nil
|
||||
joinOrder[player] = nil
|
||||
@@ -243,12 +241,24 @@ end
|
||||
local function stageOnArena(player: Player)
|
||||
placedCharacter[player] = nil
|
||||
player:SetAttribute("InArena", true)
|
||||
player.RespawnLocation = destinationFor(player)
|
||||
local destination = destinationFor(player)
|
||||
player.RespawnLocation = destination
|
||||
local character = player.Character
|
||||
clearTools(character)
|
||||
clearTools(player:FindFirstChildOfClass("Backpack"))
|
||||
clearTools(player:FindFirstChild("StarterGear"))
|
||||
return character
|
||||
return character, destination
|
||||
end
|
||||
|
||||
local function bench(player: Player)
|
||||
if not roster[player] then return end
|
||||
player:SetAttribute("ArenaWaiting", true)
|
||||
local character, destination = stageOnArena(player)
|
||||
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
|
||||
if character and humanoid and humanoid.Health > 0 then
|
||||
humanoid.Health = humanoid.MaxHealth
|
||||
ArenaSpawns.place(character, destination)
|
||||
end
|
||||
end
|
||||
|
||||
local function enterRound(player: Player, match: Match)
|
||||
@@ -283,7 +293,9 @@ local function onCharacter(player: Player, character: Model)
|
||||
end)
|
||||
if roster[player] and player:GetAttribute("InArena") == true then
|
||||
if player:GetAttribute("ArenaIntermission") == true or player:GetAttribute("ArenaWaiting") == true then
|
||||
ArenaSpawns.place(character, destinationFor(player))
|
||||
local destination = player.RespawnLocation or destinationFor(player)
|
||||
player.RespawnLocation = destination
|
||||
ArenaSpawns.place(character, destination)
|
||||
else
|
||||
enterArena(player, character, humanoid)
|
||||
end
|
||||
@@ -554,18 +566,8 @@ local function returnVoters(match: Match)
|
||||
|
||||
balanceWaiting(match)
|
||||
for _, player in returning do
|
||||
if match.rule == "OneLife" then
|
||||
player:SetAttribute("ArenaWaiting", true)
|
||||
local character = stageOnArena(player)
|
||||
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
|
||||
if character and humanoid and humanoid.Health > 0 then
|
||||
humanoid.Health = humanoid.MaxHealth
|
||||
ArenaSpawns.place(character, destinationFor(player))
|
||||
end
|
||||
else
|
||||
deploy(player)
|
||||
end
|
||||
player:SetAttribute("ArenaIntermission", nil)
|
||||
enterRound(player, match)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user