Price
$5.00A script by Qotrek
Price
$5.00Standalone Playable Guitar Script
Enhance your game with a fully interactive and network-synchronized guitar script! Perfect for roleplay, entertainment, or just jamming with friends.
-----------------
-- 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ę'
-----------------
-- 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)

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. 
| Code is accessible | No |
| Subscription-based | No |
| Lines | 1500+ LUA, 350+ HTML |
| Requirements | none |
| Support | Yes |
See what others are saying about this script.
Share your experience and help others.