Yes, apologies for late response,
Mouse.Button1Down:Connect(function()
if canshot then
if Equipped then
if Tool.Configurations.Ammo.Value > 0 then
shooting = true
if Tool.Configurations.Auto.Value == true then
repeat
if Equipped and (tick() - lastshot) >= Tool.Configurations.Cadence.Value then
lastshot = tick()
Shot()
end
game:GetService('RunService').RenderStepped:Wait()
until shooting == false or Tool.Configurations.Ammo.Value < 1
elseif Tool.Configurations.Auto.Value == false and (tick() - lastclick) > Tool.Configurations.Cadence.Value then
lastclick = tick()
Shot()
end
end
end
end
end)
Mouse.Button1Up:Connect(function()
if Equipped or shooting then
shooting = false
end
end)
Well, incase you want the, shot function, kinda a mess but here you go:
local function Shot()
Recoil()
for i,v in ipairs(Tool.Body.FirePart:GetChildren()) do
if v:IsA('ParticleEmitter') then
v.Enabled = true
end
end
if Tool.Configurations.ShotgunEnabled.Value == true then
local Part = game.ReplicatedStorage.WeaponSystem.FX.ShotgunShell:Clone()
Part.Velocity = Tool.Body.ShellEject.CFrame.LookVector.Unit * math.random(Tool.Configurations.ShellDropDistance.Value-10,Tool.Configurations.ShellDropDistance.Value) + Vector3.new(0,4,0)
Part.Transparency = 0
Part.Parent = workspace.IgnoreParts
Part.CFrame = Tool.Body.ShellEject.CFrame * CFrame.Angles(0,math.rad(90),0)
game:GetService('Debris'):AddItem(Part, 4)
elseif Tool.Configurations.ShotgunEnabled.Value == false then
local Part = game.ReplicatedStorage.WeaponSystem.FX.Shell:Clone()
Part.Velocity = Tool.Body.ShellEject.CFrame.LookVector.Unit * math.random(Tool.Configurations.ShellDropDistance.Value-10,Tool.Configurations.ShellDropDistance.Value) + Vector3.new(0,4,0)
Part.Transparency = 0
Part.Parent = workspace.IgnoreParts
Part.CFrame = Tool.Body.ShellEject.CFrame * CFrame.Angles(0,math.rad(90),0)
game:GetService('Debris'):AddItem(Part, 4)
end
game.ReplicatedStorage.WeaponSystem.Events.Shot:FireServer(Tool)
delay(0.1, function()
for i,v in ipairs(Tool.Body.FirePart:GetChildren()) do
if v:IsA('ParticleEmitter') then
v.Enabled = false
end
end
end)
if Tool.Configurations.Ammo.Value < 1 then
game.ReplicatedStorage.WeaponSystem.Events.Bolt:FireServer(true,Tool)
end
---- LA RAY Y ESO XD
if Tool.Configurations.ShotgunEnabled.Value == false then
if Equipped and not Reloading and IsThirdPerson() then
local ray = Ray.new(Tool.Body.FirePart.CFrame.p, (Mouse.hit.p - Tool.Body.FirePart.CFrame.p).unit * 5000 + Vector3.new(0,0.1,0))
local hit,position,surface = workspace:FindPartOnRayWithIgnoreList(ray, {Character, armmodel, workspace.IgnoreParts})
if hit and hit.Parent then
game.ReplicatedStorage.WeaponSystem.Events.Hit:FireServer(hit,position,surface, Tool,DamageModule[hit.Name])
if hit.Parent:FindFirstChild('Humanoid') then
script["A hit"]:Play()
end
end
--[[if (not Aiming) and IsThirdPerson() then
StopAnimations()
PlayAnimation('Shot')
delay(0.2, function()
StopAnimations()
PlayAnimation('Hold')
end)
end
end]]
end
if Equipped and not Reloading and IsFirstPerson() then
local ray = Ray.new(Tool.Body.FirePart.CFrame.Position, Tool.Body.FirePart.CFrame.LookVector.Unit * 5000)
local hit,position,surface = workspace:FindPartOnRayWithIgnoreList(ray, {Character, Camera, workspace.IgnoreParts})
if hit and hit.Parent then
game.ReplicatedStorage.WeaponSystem.Events.Hit:FireServer(hit,position,surface, Tool, DamageModule[hit.Name])
if hit.Parent:FindFirstChild('Humanoid') then
script["A hit"]:Play()
end
end
end
elseif Tool.Configurations.ShotgunEnabled.Value == true then
if Equipped and not Reloading then
for i = 1,5 do
shotgunshot()
end
end
end
end