I need help with a kill all gui

Hello my name is Basicly3pic, and i need help with making a kill all players in server UI for my admin panel. if you can, please put the script below. Thanks!

4 Likes
for _, player in pairs(game.Players:GetPlayers()) do
    player:LoadCharacter()
end

or if you don’t want instant respawn:

for _, player in pairs(game.Players:GetPlayers()) do
    player.Character:FindFirstChildOfClass("Humanoid").Health = 0
end
1 Like

You first would have to make a ScreenGui in StarterGui, then a TextButton or an ImageButton, then you would make a script and put:

script.Parent.MouseButton1Click:Connect(function()
    for _, plr in pairs(game.Players:GetPlayers()) do
        plr.Character:FindFirstChild("Humanoid").Health = 0
    end
end

I hope this helps.

3 Likes

Thank you so much! I really needed this

Screenshot_2

admin panel so far

Happy to help! I’m glad you figured it out and I hope you do great on other commands too!

Yes! Yesterday I added a Speed Changer and Kick system :wink:

Nice! I would love to play your game once it’s done.

As an admin I would use Kill All specifically for everything.

the game is coming out soon! for testing purposes I named it “Gamer Game”

image

1 Like

I have a feedback, please make text a bit small. It would fit also this is amazing!

You’ll need a RemoteEvent for this since this does not replicate to the server from a localscript.
More information can be found here: RemoteEvent | Roblox Creator Documentation

What you need to implement is :FireServer() and RemoteEvent.OnServerEvent.
On the server-side, loop through existing players, here’s an example:

local RemoteEvent = game:GetService('ReplicatedStorage').RemoteEvent -- Your RemoteEvent
local Players = game:GetService('Players')


local function OnServerEvent(Player)
	-- You might want to check who is firing this event, as exploiters can fire any RemoteEvent with any arguments.
	-- Perhaps check if the player is an admin.
	local GetPlayers = Players:GetPlayers()
	for i = 1, #GetPlayers do
		coroutine.resume(coroutine.create(function()
			-- Runs the code below in parallel for every player.
			local Target = GetPlayers[i] 
			-- Since we're accessing the player instance twice, storing it as a variable is faster to access the 2nd time (and beyond).
			if Target.Character then
				-- Check if their character exists before loading it.
				Target:LoadCharacter()
			end
		end))
	end
end


RemoteEvent.OnServerEvent:Connect(OnServerEvent)

On the client-side:

RemoteEvent:FireServer(...)