Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can you help me fix my killing GUI? It is not working and I need advice.

So basically, I am making a GUI that kills people when you put their name in a box and press the "Kill Player" Button. This is the script I came up with.

local Person = game.StarterGui.KillGUI.PlayerNameHere.Text
script.Parent.MouseButton1Click:Connect(function()
        game.Workspace.Person:BreakJoints()
end)

So basically, I put a ScreenGUI and named it KillGUI. I then put a text box in there and named it "PlayerNameHere." The game is also FilteringEnabled, just in case that helps you out. Thanks!

1 answer

First Make A Remote Event In Replicated Storage And Call It KillPlayerEvent

Secondly Here Is The Code To Put In The Kill Player Button:

local event = game.ReplicatedStorage.KillPlayerEvent
local playertokill = script.Parent.Parent.PlayerNameHere

function killselectedplr()
event:FireServer(playertokill)
end

script.Parent.MouseButton1Down:Connect(killselectedplr)

Lastly Put A Script In ServerScriptService And Put This Code In It:

local event = game.ReplicatedStorage.KillPlayerEvent

event.OnServerEvent:Connect(function(player,killselectedplr)
if workspace:FindFirstChild(killselectedplr) ~= nil then
workspace:FindFirstChild(killselectedplr):FindFirstChild("Humanoid").Health = 0
end
end)

Hope This Helps If Not Feel Free To DM Me: Harry_TheKing1#2303

I Will Soon Upload A Video On YouTube On How To Do This :)

This discussion is preserved as it was. New answers, comments, and votes are closed.