[STANDALONE] Playable Guitar Script

Standalone Playable Guitar Script

Enhance your game with a fully interactive and network-synchronized guitar script! Perfect for roleplay, entertainment, or just jamming with friends.

Features:

  • Guitar Animation – Realistic playing animations bring immersion to your gameplay.
  • 10 Playable Notes – Play different notes and create your own melodies.
  • Native Audio Sounds – Uses the built-in GTA 5 sound system for seamless and high-quality guitar sounds.
  • Full Networking Support – Everyone around can hear the music in real time!

Exposed functions:

  • Editable help text
  • On start/finish playing client functions
  • Every 500ms while playing function
  • StartPlaying on server side

Config

-----------------
-- CLIENT SIDE --
-----------------

-- Disabled controls while playing guitar https://docs.fivem.net/docs/game-references/controls/
---@type integer[]
Config.DisabledControls = {
    22,  -- SPACEBAR - JUMP
    23,  -- F
    24,  -- LEFT MOUSE BUTTON
    25,  -- RIGHT MOUSE BUTTON
    140, -- R
    143, -- SPACEBAR - MELEE BLOCK
    157, -- 1
    158, -- 2
    159, -- 6
    160, -- 3
    161, -- 7
    162, -- 8
    163, -- 9
    164, -- 4
    165, -- 5
    199, -- P
    200, -- ESC
    243  -- ~ / `
}

--- Instructional buttons help text
--- @type string
Config.HelpText = 'Schowaj gitarę'

Open LUA files

-----------------
-- CLIENT SIDE --
-----------------

function OnStartPlaying()
    LocalPlayer.state:set('currentPlayerState', 'playingGuitar', true)
end

function OnFinishPlaying()
    local playerState = LocalPlayer.state

    if playerState.currentPlayerState == 'playingGuitar' then
        playerState:set('currentPlayerState', nil, true)
    end
end

--- Run every 500 ms while playing guitar
--- @return boolean? stopPlaying
function WhilePlayingGuitar()
    if LocalPlayer.state.currentPlayerState == 'dead' then
        return true
    end

    if LocalPlayer.state.handcuffed then
        return true
    end

    if IsPedRagdoll(PlayerPedId()) then
        return true
    end
end


-----------------
-- SERVER SIDE --
-----------------

--- Registering the command to play the guitar with StartPlaying example
--- @param source integer
RegisterCommand('useGuitar', function(source)
    print('Starting to play guitar...', source)

    StartPlaying(source, function()
        print('Finished playing guitar.', source)
    end)
end, true)

Interface:

More screenshots


Preview video :movie_camera:

Any questions? Contact us on our Discord

Price: $5 + TAX

BUY NOW (TEBEX)

This script is fully standalone and easy to integrate into your game! Whether you’re a musician or just want to have fun, this is the perfect addition to your server. :blush:

Code is accessible No
Subscription-based No
Lines 1500+ LUA, 350+ HTML
Requirements none
Support Yes
6 Likes

This is really cool, do you plan on adding a list of playable songs/way for us to put “premade” songs in?

1 Like

We have prepared presets of notes that you can play to obtain popular sounds.

Playable Guitar Sheets.pdf (130.3 KB)

Enjoy a 10% discount on your first purchase through our Discord.