That is my script and it is suppost to give me and only me a tool which when activated kills everyone but me in the game . I think it went wrong because of the tools Parents though .
Here’s the script if you cannot see it clearly
game.Players.PlayerAdded:Connect(function(plr)
if plr.Name == "GHVHJGFJDUC" or plr.Name == "Player1" then
local MyClone = script.Parent:Clone()
MyClone.Parent = plr:FindFirstChild("Backpack")
script.Parent.Activated:Connect(function()
local MyWorkSpace = game.Workspace:GetChildren()
for i,v in pairs(MyWorkSpace) do
if v:IsA("Model") then
if v.Name ~= "Player1" or v.Name ~= "GHVHJGFJDUC" then
v:FindFirstChild("Humanoid").Health = 0
end
end
end
end)
end
You can’t kill everyone but you with a local script, put the player added part that gives you the tool in the server script, and in the local script, put the activated function, and fire a remote event for the server to kill all of the players. And instead of going through all of the workspace children, go through all of the players, and through their character get the humanoid and kill them.
It would not error because i have said that it will only run if the models name is a players name . For example when a player joins there model name would be Player1
PlayerService.PlayerAdded:Connect(function(Player)
if Player.Name == not OwnerName then return end
print("True")
Tool:Clone().Parent = Player.Backpack
end)
The tool will only clone to your backpack, not player 1.
script.Parent.Activated:Connect(function()
local MyWorkSpace = game.Workspace:GetChildren()
for i,v in pairs(MyWorkSpace) do
if v:IsA("Model") then
if v.Name ~= "Player1" and v.Name ~= "GHVHJGFJDUC" then
v:FindFirstChild("Humanoid").Health = 0
end
end
end
end)
it makes no difference because even if one of them is not in the game that makes it so cannot be one of them . It is hard to explain but it does the same
as or .
if v.Name ~= "Player1" or v.Name ~= "GHVHJGFJDUC" then
Tell me how can you say that v’s name can be Player1 and GHVHJGFJDUC at the same time. And or checks if the player’s name is NOT Player1 or GHVHJGFJDUC. And will check if the player’s name is both Player1 and GHVHJGFJDUC.
Wait i actually can understand why or will not work . It is because if my name is GHVHJGFJDUC then it is not = Player1 and the script will kill me anyway . This goes the other way around as well
game.Players.PlayerAdded is only for when the player is added
script.Parent.Touched:Connect(function(hit) -- this shold be inside the handle
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr and plr.Character and plr.Name == "YOURNAMEHERE" then
plr.Character.Humanoid:TakeDamage(10) -- change 10 to your damage
end
end)