1 | children = game.Players:GetChildren() |
2 |
3 | if script.Parent.Anchored = = true then |
4 | children:remove() |
5 | end |
How would I make it so that when the brick is no longer anchored it will kill everyone within a certain radius?
So first you must define whether a humanoid is there or not so maybe this might help VVV. local Player = script.Parent:FindFirstChild("Humanoid") if (Humanoid ~=nil) then do
I think the "Script.Parent:FindFirstChild" bit was a bit of track so maybe define where you would find the humanoid in example Part,GUI etc. I hope that worked. Try using the "if (Humanoid ~=nil) then do" thing because ~ means does not. And = means equals. So that means does not equal. And nil means 0 so that means if the humanoid does not equal nothing, which means if the humanoid is there then do a script.
You're removing the Players, wich would Kick them from the server, not kill them. Try this instead:
01 | while true do -- Make it loop so it keeps checking. Without this it will only check once. |
02 | wait() |
03 | if script.Parent.Anchored = = false then -- You had it on true, wich will kill the players when the brick IS anchored. False is when the brick is NOT anchored |
04 | for i,v in ipairs (game.Players:GetChildren()) do |
05 | if v.Character then |
06 | v.Character:BreakJoints() |
07 | end |
08 | end |
09 | end |
10 | end |