local gyro = GetPartFromPort(1, "Gyro")
-- Gets the player's info
local function getPlayerInfo(playerName)
-- TODO: replace this with a real function that fetches the player's info from the Roblox leaderboard API
end
-- Set up motor pins
local motorPins = {12, 13, 14} -- {1:Left Motor, 2:Right Motor, 3:Vertical Motor}
-- Set up speed for motors
local speed = 50 -- speed value between 0 and 100
-- Target player to follow
local targetPlayer = nil
-- Function to start targeting a player
function target(playerName)
targetPlayer = playerName
print("Now following " .. targetPlayer .. " in leaderboard roblox list.")
end
-- Function to stop targeting a player
function stopTargeting()
targetPlayer = nil
print("Stopped targetting the player in leaderboard roblox list.")
end
-- Set up the microphone
local microphone = GetMicrophoneFromPort(2)
-- Function to process microphone commands
function processMicrophoneCommand(command)
local detectedPlayerName = string.match(command, "target (.+) with a code block")
if detectedPlayerName then
target(detectedPlayerName)
end
end
-- Main loop
while true do
if targetPlayer then
local playerInfo = getPlayerInfo(targetPlayer)
if playerInfo then
local targetAngle = math.atan2(playerInfo.Y - 50, playerInfo.X - 50) * 180 / math.pi
gyro.targetRotationY(targetAngle)
else
print("Player not found in leaderboard roblox list.")
end
end
-- Check if the microphone is activated
if microphone.isActivated() then
-- Get the command from the microphone
local command = microphone.getCommand()
-- Process the command
processMicrophoneCommand(command)
end
wait(0.05)
end
-- Connect the "Chatted" event to the microphone
microphone.on("Chatted", function(player)
local command = player.Character.Head.SurfaceGui.TextBox.Text
processMicrophoneCommand(command)
end)
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}