how to make custom commands roblox code example
Example: basic commands roblox
function onChatted(msg, speaker)
local source = string.lower(speaker.Name)
msg = string.lower(msg)
if msg == "/respawn" then
speaker:LoadCharacter()
elseif msg == "/ff" then
Instance.new("ForceField", speaker.Character)
elseif msg == "/run" then
speaker.Character.Humanoid.WalkSpeed = 25
elseif msg == "/walk" then
speaker.Character.Humanoid.WalkSpeed = 16
elseif msg == "/sit" then
speaker.Character.Humanoid.Sit = true
end
end
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg) onChatted(msg, player) end)
end)
print ("Working.. MrMuppetTheMan - verifed")