This is run as a client. When the button 'KillOthers' is pressed, everyone except the executor is supposed to die. MainUI.All.KillOthers.MouseButton1Down:connect(function() local playersList = game.Players:GetPlayers() local currentPlayer = 1 for i, player in pairs(playersList) do if player == game.Players.LocalPlayer then table.remove(playersList, i) break end end game.Workspace.Delete.delete:BreakJoints(playersList) end)
This script is supposed to kill everyone in the server but me. What do I need to fix it?
1 answer
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local LocalPlayer = game.Players.LocalPlayer
local function MouseButton1Down ()
for i, Player in pairs(game.Players:GetPlayers()) do
if Player.Name ~= LocalPlayer.Name then
RemoteEvent:FireServer(Player)
end
end
end
MainUI.All.KillOthers.MouseButton1Down:Connect(MouseButton1Down)
--Insert a remoteevent in the replicatedstorage then a script in the serverstorage and write this script in that.
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local function OnServerEvent (LocalPlayer,Player)
local Character = Player.Character
if Character then
Character:BreakJoints()
end
end
RemoteEvent.OnClientEvent:Connect(OnServerEvent)
If the script bellow works then use that instead.
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local LocalPlayer = game.Players.LocalPlayer
local PlayerList = {}
local function MouseButton1Down ()
for i, Player in pairs(game.Players:GetPlayers()) do
if Player.Name ~= LocalPlayer.Name then
PlayerList[i] = Player
end
end
RemoteEvent:FireServer(PlayerList)
end
MainUI.All.KillOthers.MouseButton1Down:Connect(MouseButton1Down)
--Insert a remoteevent in the replicatedstorage then a script in the serverstorage and write this script in that.
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local function OnServerEvent (LocalPlayer,PlayerList)
for i=1,#PlayerList do
local Player = PlayerList[i]
local Character = Player.Character
if Character then
Character:BreakJoints()
end
end
end
RemoteEvent.OnClientEvent:Connect(OnServerEvent)
2 comments
No, this is supposed to be injected
Through an exploit. (BTW this is my game so I can exploit it) . There is an exploit through btools that allows you to do it. Look at this script: MainUI.All.SpunishOthers.MouseButton1Down:connect(function() for i,v in pairs(game.Players:GetChildren()) do if v.Name ~= game.Players.LocalPlayer.Name then game.Workspace.Delete.delete:FireServer(v.Character) end end end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
LocalScripts can't do this. Use a remote event and make the server do it.