Need Help With Scripting

Story
So, I making a parkour game, and I need help with a Gui, so i have made all of the parkour courses and everything, so i got an idea of like a trolling kind of gui which would troll another player, like killing them.

Gui

I need Help With
so i made a gui and i need help, like when a player puts another player’s name and hits the “kill” button,
i want to make it so that it should kill the player.

I tried to make it on my own but i wasnt able to.
Also I am not that good of a scripter.
Any Help Would be great for me.

Thanks For Reading,
The Spikey Man

1 Like

The problem here is most likely that you tried to get the text of the textbox from the server, but it can only be seen from the client. So, you should be using remote events.
(local script)

local button = --kill button
local name = --textbox
local killevent = --the remote event

button.MouseButton1Down:Connect(function()
    if string.len(name.Text) >= 3 and string.len(name.Text) <= 20 then
        killevent:FireServer(name.Text)
    end
end)

(server script)

local killevent = --remote event

killevent.OnServerEvent:Connect(function(plr, targetname)
    local target = game.Players:FindFirstChild(targetname)
    if target and target:IsA("Player") then
        if target.Character and target.Character.Humanoid.Health > 0 then
            target.Character.Humanoid.Health = 0
        end
    end
end)
2 Likes

@Kaid3n22 Hey, i am back, where do i put the local script and server script?

1 Like

you should probably put the local script within the GUI, the server script in ServerScriptService, and the RemoteEvent in ReplicatedStorage. Make sure to reference everything properly.

1 Like

Ok thanks very much for the help

1 Like

LikeThis
See Like This??
@Kaid3n22

Wow Bro Thank You Soo Much!
My Problem is solved!
Thanks!
:smile:

1 Like