#how to fix this equip and unequip board system

1 messages · Page 1 of 1 (latest)

polar vine
#

I wanna ask how to fix my script i can equip but cant unequip this is the fixed script but without unequip

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")

local LocalPlayer = Players.LocalPlayer
local rideOffset = Vector3.new(0, -3, 0) -- Offset to place board slightly below player

-- Find player's board model
local function getPlayerBoard()
    local boardsFolder = Workspace:FindFirstChild("Players Boards")
    if not boardsFolder then return nil end

    local playerFolder = boardsFolder:FindFirstChild(LocalPlayer.Name)
    if not playerFolder then return nil end

    local board = playerFolder:FindFirstChildWhichIsA("Model")
    return board
end

-- Move the board model to the player
local function moveBoardToPlayer()
    local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
    local board = getPlayerBoard()
    if not board or not character.PrimaryPart then return end

    -- Make sure the board has a PrimaryPart (or set one in Studio)
    board:SetPrimaryPartCFrame(character.PrimaryPart.CFrame * CFrame.new(rideOffset))
end

-- Press Q to move board
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.Q then
        moveBoardToPlayer()
    end
end)