Ive been working on a game and I have a third person gun system and I want it so when you pull the gun out the crosshair shows up but it hasn’t been working im not sure why ive tried putting it in different places and everything
-- local crosshair = script.Parent.Crosshair
local isGunEquipped = false
-- Function to show the crosshair
local function showCrosshair()
crosshair.Visible = true
end
-- Function to hide the crosshair
local function hideCrosshair()
crosshair.Visible = false
end
-- Function to handle changes in gun equipment
local function handleGunEquipment(isEquipped)
if isEquipped then
-- Show crosshair when any gun is equipped
showCrosshair()
else
-- Hide crosshair when no gun is equipped
hideCrosshair()
end
end
-- Connect gun events to the crosshair system
game.GlockEXT.Equipped:Connect(function()
handleGunEquipment(true)
end)
game.GlcokEXT.Unequipped:Connect(function()
handleGunEquipment(false)
end)