Hiya Developers!
I have a script line here, which states a Value when something happens.
status.Value = hit.Parent.Name.." Has Won!"
Is there anyway when the " Has Won" status appears, all players in the folder called “Ingame” in workspace will be killed?
local players = game:GetService("Players")
if status.Value == hit.Parent.Name.." Has Won!" then
for _, player in players:GetPlayers() do
player.Character:BreakJoints()
end
end
Will need to be a server script.
How do i only kill players in the “Ingame” folder though? As when a round starts, all players get moved to that folder, and whenever they die they get moved out. So i only need to kill players still in the Ingame folder?
What’s the in-game folder named?
The folder is named Ingame and is in Workspace.
In what way are the players being stored within that folder?
When your in a round, you get put into that folder.
If the player dies or a round ends, they get removed from “Ingame”.
I assume you’re reassigning the Parent property of the player to the folder.
if status.Value == hit.Parent.Name.." Has Won!" then
for _, player in pairs(workspace.Ingame:GetChildren()) do
if player.Character then
player.Character:BreakJoints()
end
end
end
Thanks ill try this now and see if it works.
I got: Character is not a valid member of Model “Workspace.Ingame.Y0utube_Dino”
Can you share the code which moves the players to the folder? Thanks.
Here is the code for it: players[i].Character.Parent = workspace.Ingame
players = game:GetService("Players")
for i, player in pairs(players:GetPlayers()) do
player.Character.Parent = game.Workspace.Folder
end
for _, char in pairs(workspace.Folder:GetChildren()) do
if char.Humanoid then
char:BreakJoints()
end
end
1 Like
Thanks, ill try this now and see if it works!
Should work, I tested in Studio. Before I thought you were moving the entire player, not just the player’s character.
Thanks, this worked perfectly!