Skip to content
TheChatArchiveThe Chat Archive
Qwenqwen3-235b-a22b-no-thinking· Alibaba (Qwen)Hugging Face LMArena Human Preference 140K

can u make it so it doesnt need a primary part and just move the WHOLE model according…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Mistralmistral-small-2506’s answer.
  1. User

    can u make it so it doesnt need a primary part and just move the WHOLE model according to the keys the user presses? bc i made a script using a primary but it didnt work due to it only moving the primary part with it btw this is optional just make it work!

  2. Qwen Assistant

    Absolutely! If you don't want to use a PrimaryPart and instead move the entire model as one unit, we can do that by adjusting the boat’s CFrame. This works well if your boat is a self-contained Model and all parts are grouped together (not scattered).

    We’ll keep the same architecture:

    • LocalScript: Detects input.
    • RemoteEvent: Communicates with the server.
    • ServerScript: Moves the entire Model based on input.

    ✅ Step-by-step Setup:

    1. Add this RemoteEvent in ReplicatedStorage

    Name it: BoatMovementEvent


    2. LocalScript (Client-side Input)

    Place this in StarterPlayerScripts or StarterGui

    local UserInputService = game:GetService("UserInputService")
    local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local Players = game:GetService("Players")
    local player = Players.LocalPlayer
    
    local BoatMovementEvent = ReplicatedStorage:WaitForChild("BoatMovementEvent")
    
    local currentBoat = nil
    local isSeated = false
    
    -- Detect when seated in a BoatSeat
    player.CharacterAdded:Connect(function(char)
        char:WaitForChild("Humanoid").Seated:Connect(function(seated, seat)
            if seated and seat and seat.Name == "BoatSeat" then
                currentBoat = seat:FindFirstAncestorOfClass("Model")
                isSeated = true
            else
                isSeated = false
                currentBoat = nil
            end
        end)
    end)
    
    -- Handle key presses
    UserInputService.InputBegan:Connect(function(input, gameProcessed)
        if gameProcessed or not isSeated or not currentBoat then return end
    
        local key = input.KeyCode
        if key == Enum.KeyCode.W then
            BoatMovementEvent:FireServer(currentBoat, "Forward")
        elseif key == Enum.KeyCode.S then
            BoatMovementEvent:FireServer(currentBoat, "Backward")
        elseif key == Enum.KeyCode.A then
            BoatMovementEvent:FireServer(currentBoat, "Left")
        elseif key == Enum.KeyCode.D then
            BoatMovementEvent:FireServer(currentBoat, "Right")
        end
    end)
    
    -- Optional: Stop movement when releasing keys
    UserInputService.InputEnded:Connect(function(input, gameProcessed)
        if gameProcessed or not isSeated or not currentBoat then return end
    
        local key = input.KeyCode
        if key == Enum.KeyCode.W or key == Enum.KeyCode.S or key == Enum.KeyCode.A or key == Enum.KeyCode.D then
            BoatMovementEvent:FireServer(currentBoat, "Stop")
        end
    end)
    

    3. ServerScript (Handles Movement of Whole Model)

    Place this in the boat model or in ServerScriptService

    local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local RunService = game:GetService("RunService")
    
    local BoatMovementEvent = ReplicatedStorage:WaitForChild("BoatMovementEvent")
    
    local MOVEMENT_SPEED = 10  -- studs per second
    local TURN_SPEED = 1.5     -- radians per second
    
    -- Table to track each boat's current movement state
    local BoatStates = {}  -- [boat] = { move = "", turn = "" }
    
    -- Update every frame
    RunService.Heartbeat:Connect(function(deltaTime)
        for boat, state in pairs(BoatStates) do
            if not boat:IsDescendantOf(workspace) then
                BoatStates[boat] = nil
                continue
            end
    
            local cf = boat.CFrame
    
            -- Move forward/backward
            if state.move == "Forward" then
                local moveVector = cf.LookVector * MOVEMENT_SPEED * deltaTime
                moveVector = Vector3.new(moveVector.x, 0, moveVector.z) -- Keep Y level constant
                boat:SetPrimaryPartCFrame(cf + moveVector)
            elseif state.move == "Backward" then
                local moveVector = -cf.LookVector * MOVEMENT_SPEED * deltaTime
                moveVector = Vector3.new(moveVector.x, 0, moveVector.z)
                boat:SetPrimaryPartCFrame(cf + moveVector)
            end
    
            -- Turn left/right
            if state.turn == "Left" then
                boat:SetPrimaryPartCFrame(cf * CFrame.Angles(0, -TURN_SPEED * deltaTime, 0))
            elseif state.turn == "Right" then
                boat:SetPrimaryPartCFrame(cf * CFrame.Angles(0, TURN_SPEED * deltaTime, 0))
            end
        end
    end)
    
    -- Listen for input from client
    BoatMovementEvent.OnServerEvent:Connect(function(player, boat, command)
        if not boat or not boat:IsA("Model") or not boat:FindFirstChild("BoatSeat") then return end
    
        -- Validate the player is sitting in the boat
        local seat = boat:FindFirstChild("BoatSeat")
        if not seat or not seat.Occupant or seat.Occupant.Parent ~= player.Character then return end
    
        -- Initialize boat in states table if not present
        if not BoatStates[boat] then
            BoatStates[boat] = { move = "Stop", turn = "Stop" }
            boat.PrimaryPart = seat -- Set PrimaryPart to the seat so SetPrimaryPartCFrame works
        end
    
        -- Update the movement/turning state
        if command == "Forward" or command == "Backward" then
            BoatStates[boat].move = command
        elseif command == "Left" or command == "Right" then
            BoatStates[boat].turn = command
        elseif command == "Stop" then
            -- You could differentiate between stop move vs stop turn if needed
            BoatStates[boat].move = "Stop"
            BoatStates[boat].turn = "Stop"
        end
    end)
    

    🎯 Key Features:

    • No need to set PrimaryPart manually — script sets it to the BoatSeat.
    • Entire model moves together using SetPrimaryPartCFrame().
    • Y-level stays constant (y component of movement is zeroed).
    • Smooth movement via Heartbeat.
    • Only players sitting in the BoatSeat can control the boat.

    💡 Tips:

    • Make sure your boat is a Model with a part named "BoatSeat" inside it.
    • The seat must be a VehicleSeat or at least have an Occupant property.
    • If you don’t want to use SetPrimaryPartCFrame, you’d have to loop through and reposition every part — which is messy. Using PrimaryPart keeps things simple and efficient.

    Let me know if you'd like to add features like:

    • Boost / drift
    • Water physics / floating
    • Engine sound effects
    • Multiple seats (passenger system)

    Happy sailing! 🚤🌊

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