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

Kill a certain named player? (SOLVED IT)

Asked by 3 years ago
Edited 3 years ago

I need help. I want this script to kill a player with a certain name when he touches a part. My script isn't working, there aren't any errors and the "1" prints fine.

local name = "Just_T0m"
script.Parent.Touched:Connect(function(hit)

    if hit.Parent:FindFirstChild("Humanoid") then
        print("1")
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        local character = hit.Parent

        if player.Name == name then
            --
        end
    end
end)

1 answer

Log in to vote
0
Answered by 3 years ago

The solution was adding the actual kill function lol

script.Parent.Touched:Connect(function(hit)

    if hit.Parent:FindFirstChild("Humanoid") then

        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        local character = hit.Parent
        local name = "Just_T0m"

        if player.Name == name then
            hit.Parent:BreakJoints()

        end
    end
end)
Ad

Answer this question