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 -- Respawns them
		speaker:LoadCharacter()
	elseif msg == "/ff" then
		Instance.new("ForceField", speaker.Character)
	elseif msg == "/run" then -- Makes them run
		speaker.Character.Humanoid.WalkSpeed = 25
	elseif msg == "/walk" then -- Makes them walk
		speaker.Character.Humanoid.WalkSpeed = 16
	elseif msg == "/sit" then -- Makes them sit
		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")

-- Put in ServerScriptService, you can remove any of the commands or chnage there command by going in the "" where the command is and deleting it or changing it. 
-- Discord = Muppet#6931
-- These commands are for everone to use

Tags:

Lua Example