I'm trying to make a simple 'kill command' in Roblox Studio where you type ";kill player" and it will kill them.
The part I am struggling with is how on earth to separate the words before and after the space, and store them as variables?
Steps I need in my code:
The rest I can figure out on my own.
Here's what my code is currently:
local Owner = "Djraco"
local Prefix = ";"
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
--<code goes here>
end)
end)
Thanks in advance!
local Owner = "Djraco"
local Prefix = ";"
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
local msg = msg:split(" ") -- Seperate your message every space
if player.Name == Owner and msg[1] == "kill" and msg[2] ~= nil then game:GetService("Players")[msg[2]].Character.Humanoid.Health = 0 end
end)
end)
The above should work. Let me know if you need more help.