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

How to get peoples Names using FindFirstChild() ? [closed]

Asked by 5 years ago
Edited 5 years ago

I was looking everywhere on the internet and i couldn't Find it so i decided to ask here. So i'm trying to make an admin script everything is going good but there's one problem. How do i get peoples Names by using find first child? my name is oskar2266001 so if i want to type ;ban osk it would ban me? Please help here's the code.

wait(3)

local Admin = "oskar2266001"

local BanList = Instance.new("Folder",game.ReplicatedStorage)

local Prefix = ";"



BanList.Name = "BanList"





local Players = game:GetService("Players")

for i, player in pairs(Players:GetPlayers()) do

    if player.Name == Admin then

        game.Players[Admin].Chatted:connect(function(msg)

            if msg == Prefix.."shutdown" then

            for i, player in pairs(Players:GetPlayers()) do

            game.Players[player.Name]:Kick("The Game was Shutdown By "..Admin)

    end

end


if msg:sub(1, 6) == Prefix.."kill " then

    local Target = game.Players:FindFirstChild(msg:sub(7))

        if Target then

            local Character = Target.Character

            if Character then

            Character.Humanoid.Health = 0

        end

    end

end


if msg:sub(1, 6) == Prefix.."kick " then

    local Target = game.Players:FindFirstChild(msg:sub(7))

            if Target then

            Target:Kick("You have Been Kicked By "..Admin)

            end

            end

        end)

    end

end

Closed as Non-Descriptive by User#24403

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?