Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-instant-1· AnthropicHugging Face Arena Human Preference 55K

convert this roblox movement script to MTA SA LUA local ContextActionService =…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with gpt-3.5-turbo-0314’s answer.
  1. User

    convert this roblox movement script to MTA SA LUA local ContextActionService = game:GetService("ContextActionService") local RunService = game:GetService("RunService")

    local player = game:GetService("Players").LocalPlayer local camera = workspace.CurrentCamera

    local character local humanoidRootPart local humanoid local groundCheck

    player.CharacterAdded:Connect(function(newCharacter)

    character = newCharacter
    
    humanoidRootPart = character:WaitForChild("HumanoidRootPart")
    humanoid = character:WaitForChild("Humanoid")
    
    groundCheck = script.GroundCheck:Clone()
    groundCheck.Weld.Part0 = humanoidRootPart
    groundCheck.Parent = character
    

    end)

    local Cmd = {

    upMove = false;
    downMove = false;
    
    leftMove = false;
    rightMove = false;
    
    lastUp = false;
    lastLeft = false;
    
    jump = false;
    justPressed = false;
    
    crouch = false;
    cjustPressed = false;
    

    }

    local function onUp(actionName, inputState)

    if inputState == Enum.UserInputState.Begin then
    
    	Cmd.upMove = true
    	Cmd.lastUp = true
    
    elseif inputState == Enum.UserInputState.End then
    
    	Cmd.upMove = false
    
    end
    

    end

    local function onLeft(actionName, inputState)

    if inputState == Enum.UserInputState.Begin then
    
    	Cmd.leftMove = true
    	Cmd.lastLeft = true
    
    elseif inputState == Enum.UserInputState.End then
    
    	Cmd.leftMove = false
    
    end
    

    end

    local function onDown(actionName, inputState)

    if inputState == Enum.UserInputState.Begin then
    
    	Cmd.downMove = true
    	Cmd.lastUp = false
    
    elseif inputState == Enum.UserInputState.End then
    
    	Cmd.downMove = false
    
    end
    

    end

    local function onRight(actionName, inputState)

    if inputState == Enum.UserInputState.Begin then
    
    	Cmd.rightMove = true
    	Cmd.lastLeft = false
    
    elseif inputState == Enum.UserInputState.End then
    
    	Cmd.rightMove = false
    
    end
    

    end

    local function onJump(actionName, inputState)

    if inputState == Enum.UserInputState.Begin then
    
    	Cmd.jump = true
    	Cmd.justPressed = true
    
    elseif inputState == Enum.UserInputState.End then
    
    	Cmd.jump = false
    
    end
    

    end

    local function onCrouch(actionName, inputState)

    if inputState == Enum.UserInputState.Begin then
    
    	Cmd.crouch = true
    	Cmd.cjustPressed = true
    
    elseif inputState == Enum.UserInputState.End then
    
    	Cmd.crouch = false
    
    end
    

    end

    ContextActionService:BindAction("Up", onUp, false, "w") ContextActionService:BindAction("Left", onLeft, false, "a") ContextActionService:BindAction("Down", onDown, false, "s") ContextActionService:BindAction("Right", onRight, false, "d") ContextActionService:BindAction("Jump", onJump, false, Enum.KeyCode.Space) ContextActionServ

  2. Claude Assistant

    Here's the converted MTA SA Lua movement script:

    local player = GetPlayerPed(PlayerId()) local onGround = true

    AddEventHandler("playerSpawned", function() RequestCollisionAtCoord(0.0, 0.0, 0.0) while not HasCollisionLoadedAroundEntity(player) do Wait(0) end end)

    local function MovePlayer(dx, dy, dz) SetEntityCoords(player, GetEntityCoords(player) + dx, GetEntityCoords(player) + dy, GetEntityCoords(player) + dz, 1, 0, 0, 1)
    end

    local function IsPlayerOnGround() local z = GetEntityCoords(player) RequestCollisionAtCoord(z.x, z.y, z.z) return GetGroundZFor_3dCoord(z.x, z.y, z.z, z.z - 100.0) == z.z
    end

    AddKeypressListener(VK_UP, function() if onGround then MovePlayer(0, 0, 0.01) end end)

    AddKeypressListener(VK_LEFT, function() MovePlayer(-0.01, 0, 0) end)

    AddKeypressListener(VK_DOWN, function() MovePlayer(0, 0, -0.01) end)

    AddKeypressListener(VK_RIGHT, function() MovePlayer(0.01, 0, 0) end)

    AddKeypressListener(VK_SPACE, function() if onGround then SetEntityVelocity(player, 0,0,0.5) onGround = false end end)

    Citizen.CreateThread(function() while true do onGround = IsPlayerOnGround() Citizen.Wait(0) end end)

    Hope this helps! Let me know if you have any other questions.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.