Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Admin commands not working???

I placed the following code inside of serverscriptstorage and into a normal script also I tried to make a God Command and it won't work for some reason... I made it so when you say "GodMode ....." it will give the person whose name you say after "GodMode " a health of 9999999999 and a maxhealth of that as well and it will weld a part on top of that person.... Please help me with this I am really new to admin commands and want to do them and I also want to make commands with 3 different parts to it like "Speed Player 100" something like that if you could give me answer to those 2 it would be great.... Questions What is wrong with my God Mode script? How to make a admin command with 3 parts to it such as "Speed PlayersName Value(100, 300, etc)...

admins = {"KingLoneCat", "Player1"}
game.Players.PlayerAdded:connect(function(player)
	player.Chatted:connect(function(msg)
		    for _, admin in next, admins do
		local messages = {"GodMode ", "God "}
		for i,v in next, messages do
		if player.Name == admin and msg == v then
		local args = messages:sub(8)
		local player1 = game.Players[args]
		if player1 then
		player1.Character:findFirstChild("Humanoid").MaxHealth = 999999999999999
		player1.Character:findFirstChild("Humanoid").Health = player1.Character:findFirstChild("Humanoid").MaxHealth
		local part = Instance.new([[Part]],workspace)
        part.Size = Vector3.new(1,1,1)
        part.Transparency =.3
        part.Reflectance =.5
        part.TopSurface = [[Smooth]]
        part.Material = [[Neon]]
        part.BrickColor = BrickColor.new([[New Yeller]])
        part.CanCollide = false
        part.BottomSurface =[[Smooth]]
        local sm = Instance.new([[SpecialMesh]],part)
        sm.MeshType = [[FileMesh]]
        sm.MeshId = [[http://www.roblox.com/asset/?id=1078075]]
        sm.Scale = Vector3.new(3,0,3)
        part.CFrame = workspace[args].Torso.CFrame
        local weld = Instance.new([[Weld]], part)
        weld.Part0 = part
        weld.Part1 = workspace[args].Torso
        weld.C0 = CFrame.new(0,-5,0)
        while true do
        weld.C0 = weld.C0*CFrame.fromEulerAnglesXYZ(0,360,0)
        wait()
        end
        end
		end
		end
		end
		end)
end)

1 answer

Try this You need to put the full name of the player example :god KingLoneCat "sanic" is 200 speed

admin = game.Players.KingLoneCat
prefix = ":"

function onChatted(msg)
       if msg:lower():sub(1,4) == prefix.."god " then
       local plr = game.workspace:FindFirstChild(msg:lower():sub(5,#msg))
		if plr then
			plr.Humanoid.Health = 99999999
end
end
end
admin.Chatted:connect(onChatted)
function onChatted(msg)
       if msg:lower():sub(1,6) == prefix.."sanic  " then
        local plr = game.workspace:FindFirstChild(msg:lower():sub(5,#msg))
		if plr then
			plr.Humanoid.WalkSpeed = 200
end
end
end
admin.Chatted:connect(onChatted)

1 comment

0

Oh, so you used "#msg" to identify what he says after the name?

This discussion is preserved as it was. New answers, comments, and votes are closed.