Use elseifs preferably, it would make no sense to use if statements. Use elseifs as it will be repetable, you can just stack commands.
Ok, question why canāt I just keep using else statements would that work?
Else works for only one time use usually and it would determine if the command is not it, elseifs are the modern way. However I will once remind that this is not a proper way of an administrator system.
Also your Rename command wonāt work as it needs to be Humanoid.DisplayName, do not rename the rootpart.
I keep telling you,you cannot use else statements multiple times!! elseif statements are infinite, where as else statements are only one!
Ok, here my script. Tell me if u like it.
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(15423675) >= 245 then
Player.Chatted:Connect(function(Command)
local SplitCommand = Command:split(" ")
--Kill Player
if SplitCommand[1] == ":kill" or SplitCommand[1] == ":Kill" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.Health = 0
--Kill Player
--Infinite Health
elseif SplitCommand[1] == ":god" or SplitCommand[1] == ":God" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.Health = 10000000000
--Infinite Health
end
Is this script good?
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(15423675) >= 245 then
Player.Chatted:Connect(function(Command)
local SplitCommand = Command:split(" ")
--Kill Player
if SplitCommand[1] == ":kill" or SplitCommand[1] == ":Kill" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.Health = 0
--Kill Player
--Infinite Health
elseif SplitCommand[1] == ":god" or SplitCommand[1] == ":God" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.Health = 10000000000
--Infinite Health
end
Overly used elseifs are not always good, it is good to use a table of commands and match of the chat message and perform an action after that, and thats why modulescripts are good to be organized.
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(15423675) >= 245 then
Player.Chatted:Connect(function(Command)
local SplitCommand = Command:split(" ")
--Kill Player
if SplitCommand[1] == ":kill" or SplitCommand[1] == ":Kill" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.Health = 0
--Kill Player
--Infinite Health
elseif SplitCommand[1] == ":god" or SplitCommand[1] == ":God" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.Health = 10000000000
--Infinite Health
end
end)
end
end)
This will work, your previous missed ends, also control the MaxHealth of the Humanoid.
What do you mean by max health??
Name.Character.Humanoid.Health = 10000000000
Name.Character.Humanoid.MaxHealth = 10000000000
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(15423675) >= 245 then
Player.Chatted:Connect(function(Command)
local SplitCommand = Command:split(" ")
--Kill Player
if SplitCommand[1] == ":kill" or SplitCommand[1] == ":Kill" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.Health = 0
--Kill Player
--Godmode
elseif SplitCommand[1] == ":god" or SplitCommand[1] == ":God" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.MaxHealth = 10000000000
--Godmode
--Ungodmode
elseif SplitCommand[1] == ":ungod" or SplitCommand[1] == ":Ungod" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.Health = 100
--Ungodmode
end
end)
end
end)
Like that?
Looks good! Nice work! Admin commands are hard.
No. Keep the Health Statement, and add also the Health
Ye I know, I watching a video and itās pretty hard. The video donāt cover that much so I really got to use my head. Plus Iām a bad scripter lol
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(15423675) >= 245 then
Player.Chatted:Connect(function(Command)
local SplitCommand = Command:split(" ")
--Kill Player
if SplitCommand[1] == ":kill" or SplitCommand[1] == ":Kill" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.Health = 0
--Kill Player
--Godmode
elseif SplitCommand[1] == ":god" or SplitCommand[1] == ":God" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.MaxHealth = 10000000000
Name.Character.Humanoid.Health = 10000000000
--Godmode
--Ungodmode
elseif SplitCommand[1] == ":ungod" or SplitCommand[1] == ":Ungod" then
local TargetedPlayer = SplitCommand[2]
local Name = game.Players:FindFirstChild(TargetedPlayer)
Name.Character.Humanoid.MaxHealth = 100
Name.Character.Humanoid.Health = 100
end
end)
end
end)
Ok, got it! Let me try that out
I have joined your server, and I am indeed willing to help you.
What do you mean joined your server?
Your countyās server was on your profile.
I thouā¦ say wa. That aināt suppose to be publicā¦ I set it to friends onlyā¦ Itās suppose to me privateā¦ say wa