So basically, recently I got to make my bolt action gun but a problem keeps repeating and it confuses my brain and just outright makes me angry
And this problem is this:
Rifle fires → either these 2 happens
- The rifle just unequips itself
- The rifle reloads like it should be but it’s jammed
Visually, the code is this one:
function framework:fire(bool)
if self.reloading then return end
if self.firing then return end
if not self.vm then return end
self.firing = bool
if not bool then
return
end
local function fire()
local sound = self.handle:WaitForChild("Fire"):Clone()
sound.Parent = self.char
sound.PlayOnRemove = true
game:GetService("Debris"):AddItem(sound, .1)
ammo -= 1
springs.fire:shove(Vector3.new(.2, math.random(-.02, .02), .5))
modules.animHandler.PlayAnim(self.animsFold.Fire)
print(ammo)
--//flashes here soon
if ammo <= 0 then framework:reload() end
end
if self.settings.wepdata.wepType == "bolt" then
fire()
--self.firing = false
print("firing bolt")
elseif self.settings.wepdata.wepType == "semi" then
fire()
print("firing semi")
elseif self.settings.wepdata.wepType == "auto" then
repeat
self.canFire = false
fire()
self.canFire = true
print("firing auto")
until ammo <= 0
end
print(bool)
end
Even I asked my friend to help he said, its weird. It works and doesn’t contain any errors yet it does not work like it’s supposed too
If you need more code to figure out the problem send it here thx y’all