首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我如何设置一些名称,以便能够在roblox中输入命令来杀死其他人

我如何设置一些名称,以便能够在roblox中输入命令来杀死其他人
EN

Stack Overflow用户
提问于 2018-12-27 00:57:22
回答 1查看 126关注 0票数 0

我正在打造一个到处流传的大亨,我想要管理员的权力,这让我想起了奥斯汀的权力。无论如何,我需要一些东西让我输入:kill name或类似的东西,才能杀死任何人!请帮帮忙,我只找到了别人的一个答案,但我不能理解,我试图找到正确的语法,我不能弄明白。

虽然我找到了这个,但它只为那个人做,也许像kill/..player.Name这样的东西?

代码语言:javascript
复制
game.Players.PlayerAdded:connect(function(player) --this gets the player that connected
player.Chatted:connect(function(message) --this function executes when the player type into chat
--commands are here
if player.Name == "AlexanderYar" or player.Name == "nathancain" or player.Name == "block100000" then
    if message == "kill/me" then
        player.Character.Head:remove()
        end

    if message == "ff/me" then
        if player.Character:findFirstChild("ForceField") then
            player.Character.ForceField:Destroy()
        end

        Instance.new("ForceField").Parent = player.Character
        end

    if message == "unff/me" then 
        if player.Character:findFirstChild("ForceField") then
            player.Character.ForceField:Destroy()
            end
        end
    end
end)
end)
EN

回答 1

Stack Overflow用户

发布于 2019-01-02 16:45:04

的原始代码是:

代码语言:javascript
复制
if message == "kill/me" then
    player.Character.Head:remove()
end

替换为以下代码:

代码语言:javascript
复制
if string.sub(message,1,5) == "kill/" then
    local targetName = string.sub(message,6)
    if targetName == "me" or targetName == "Me" then
        player.Character.Head:Destroy()
    else
        for i,v in ipairs(game.Players:GetPlayers()) do
            if string.lower(v.Name) == string.lower(targetName) and v.Character and v.Character:FindFirstChild("Head") then
                v.Character.Head:Destroy()
            end
        end
    end
end

现在应该可以用来杀死其他玩家了!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53934857

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档