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!
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
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.
Thank you so much! I really needed this
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
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”
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(...)