Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This script is supposed to kill everyone in the server but me. What do I need to fix it?

Asked by 5 years ago

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)

0
LocalScripts can't do this. Use a remote event and make the server do it. SaltyIceberg 81 — 5y

1 answer

Log in to vote
0
Answered by
CjayPlyz 643 Moderation Voter
5 years ago
Edited 5 years ago
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)
0
No, this is supposed to be injected NotKnowWhatToDo_Alf1 2 — 5y
0
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)` NotKnowWhatToDo_Alf1 2 — 5y
Ad

Answer this question