You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Ans: Trying to make it so the “gun doesnt fire everytime it is Unequipped or Equipped” -
What is the issue? Include screenshots / videos if possible!
Ans:It fires when the gun is Unequipped and Equipped -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Ans: Nothing I’m confused I read the documentation
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ContextActionService = game:GetService("ContextActionService")
local IsEquiped = false
-------------------------------------------
local Gun = script.Parent
local FireRemote = Gun:WaitForChild("FireGunRemoteEvent")
local GunConfig = require(Gun.GunConfig)
-------------------------------------------
local function Fire()
print("Fired Gun...")
end
Gun.Equipped:Connect(function()
ContextActionService:BindAction("Fire_Gun",Fire,true,Enum.UserInputType.MouseButton1,Enum.UserInputType.Touch)
print("Equipped")
end)
Gun.Unequipped:Connect(function()
ContextActionService:UnbindAction("Fire_Gun")
print("Unequipped")
end)