我正在打造一个到处流传的大亨,我想要管理员的权力,这让我想起了奥斯汀的权力。无论如何,我需要一些东西让我输入:kill name或类似的东西,才能杀死任何人!请帮帮忙,我只找到了别人的一个答案,但我不能理解,我试图找到正确的语法,我不能弄明白。
虽然我找到了这个,但它只为那个人做,也许像kill/..player.Name这样的东西?
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)发布于 2019-01-02 16:45:04
的原始代码是:
if message == "kill/me" then
player.Character.Head:remove()
end将替换为以下代码:
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现在应该可以用来杀死其他玩家了!
https://stackoverflow.com/questions/53934857
复制相似问题