You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
When they teleport back to the lobby, the sword in their inventory must be removed. -
What is the issue?
I have tried multiple methods and none will work, I can’t remove the swords from the players. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub? (yes)
I’ve tried looping through the playerlist, didn’t work, I’ve tried removing it when they touch a part in
the lobby, that removed it, but made it so that they couldn’t get it back after.
while true do
wait(1)
if gameMode == 1 then -- Intermission
-- set the intermissionTime to the intTimerlabel text ON BOTH LABELS
interTimerLabel.Text = tostring(intermissionTime)
interTimerLabel2.Text = tostring(intermissionTime)
-- decrement intermissionTime
intermissionTime = intermissionTime - 1
-- if it hits 0, set it back to 30, switch gamemode, and teleport players
if intermissionTime < 1 then
-- change the current gameMode to round in progress (2)
gameMode = 2
intermissionTime = 31
-- Give all the players in the game swords
for _,player in ipairs(game.Players:getChildren()) do
local tool = game.ReplicatedStorage.ClassicSword:Clone()
tool.Parent = player.Backpack
end
-- teleport all the players to the arena
target = CFrame.new(14, 1.715, 62.3) --could be near a brick or in a new area
for i, player in ipairs(game.Players:GetChildren()) do
--Make sure the character exists and its HumanoidRootPart exists
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
--add an offset of 5 for each character
player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
end
end
end
elseif gameMode == 2 then -- Match in progress
-- set the arenaTimer text to matchTime
arenaTimerLabel.Text = tostring(matchTime)
-- decrement matchTime by 1
matchTime = matchTime - 1
-- if matchTime gets to 0, set it back to 180, switch gamemode, and teleport players
if matchTime < 1 then
-- change gamemode to intermission
gameMode = 1
intermissionTime = 31
matchTime = 181
-- sword is removed when the player touches the lobby floor
-- teleport all the players to the LOBBY
target = CFrame.new(24.5, 57.305, 50.4) --could be near a brick or in a new area
for i, player in ipairs(game.Players:GetChildren()) do
--Make sure the character exists and its HumanoidRootPart exists
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
--add an offset of 5 for each character
player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
end
end
end
end
end