local RS = game:GetService("ReplicatedStorage")
local Functions = RS:WaitForChild("Functions")
local TS = game:GetService("TweenService")
local Clones = RS:WaitForChild("Clones")
local BulletFolder = game.Workspace.BulletFolder
local DebrisFolder = game.Workspace.DebrisFolder
local EffectCD = 4
local BulletBlastRemote = Functions:WaitForChild("DarkMatter"):WaitForChild("BulletBlast")
local FastCast = require(RS.Modules.FastCastRedux)
local Manager = require(RS:WaitForChild("Modules"):WaitForChild('Manager'))
local function Bullet(player:Player, mousePos:CFrame,dmg:IntValue,count:IntValue)
local humrp = nil
local Range = 100
if count == 0 or count == 2 then
humrp= player.Character.RightHand
else
humrp= player.Character.LeftHand
end
local NewBullet = Clones:WaitForChild("DarkMatterBullet"):Clone()
NewBullet.Parent = BulletFolder
NewBullet.CFrame = humrp.CFrame + humrp.CFrame.LookVector
NewBullet.CFrame = CFrame.new(NewBullet.CFrame.p,mousePos)
local soundFX = RS.SoundFX:WaitForChild("DarkMatterBullet"):Clone()
soundFX.Parent = NewBullet
soundFX:Play()
soundFX.Ended:Connect(function()
soundFX:Destroy()
end)
local BV = Instance.new("BodyVelocity",NewBullet)
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity = NewBullet.CFrame.LookVector * 400
BV.P = math.huge
delay(0.25,function()
NewBullet:Destroy()
end)
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {humrp.Parent, BulletFolder}
Params.FilterType = Enum.RaycastFilterType.Blacklist
local result = workspace:Raycast(NewBullet.Position,NewBullet.CFrame.LookVector * 100,Params)
if not result then return end
if result then
local part = result.Instance
print(part)
local humanoid = part.Parent:FindFirstChild("Humanoid") or part.Parent.Parent:FindFirstChild("Humanoid")
if humanoid and part.Parent:FindFirstChild("Safe") == nil then
humanoid.Health -= 10
local char:Model = part.Parent
if char.UpperTorso:FindFirstChild("BulletBlast") then
else
local VFX = Clones.Particles.AttatchmentContainer.BulletBlast:Clone()
VFX.Parent = char.UpperTorso
VFX.Name = "BulletBlast"
VFX.ParticleEmitter:Emit(1)
game.Debris:AddItem(VFX,EffectCD)
end
local player:Player = game.Players:GetPlayerFromCharacter(char)
if player then
local Event = RS.Functions.ScreenChange
Event:FireClient(player,24, Color3.fromRGB(72, 36, 108), EffectCD)
end
end
end
end
local count = 0
local OriginalFire = os.time()
BulletBlastRemote.OnServerEvent:Connect(function(player,mousePos,dmg,staminaCost)
local animation = nil
if count == 0 or count == 2 then
animation = RS:WaitForChild("Anims"):WaitForChild("RightThrow")
elseif count == 1 then
animation = RS:WaitForChild("Anims"):WaitForChild("LeftThrow")
else
animation = nil
end
if animation ~= nil then
local anim:AnimationTrack = player.Character.Humanoid:LoadAnimation(animation)
anim:Play()--anim:AdjustSpeed(0.5)
end
wait(0.1)
if count == 0 then
OriginalFire = os.time()
end
if count < 3 then
local CurrentFire = os.time()
if (CurrentFire - OriginalFire) < 3 then
Bullet(player,mousePos,dmg)
count += 1
BulletBlastRemote:FireClient(player,false)
else
count = 0
BulletBlastRemote:FireClient(player,true)
end
else
count = 0
BulletBlastRemote:FireClient(player,true)
end
end)
This is my code, the problem I have is whenever I shoot the void, I can’t shoot after that…
local RS = game:GetService("ReplicatedStorage")
local Functions = RS:WaitForChild("Functions")
local TS = game:GetService("TweenService")
local Clones = RS:WaitForChild("Clones")
local BulletFolder = game.Workspace.BulletFolder
local DebrisFolder = game.Workspace.DebrisFolder
local EffectCD = 4
local BulletBlastRemote = Functions:WaitForChild("DarkMatter"):WaitForChild("BulletBlast")
local FastCast = require(RS.Modules.FastCastRedux)
local Manager = require(RS:WaitForChild("Modules"):WaitForChild('Manager'))
local function Bullet(player:Player, mousePos:CFrame,dmg:IntValue,count:IntValue)
local humrp = nil
local Range = 100
if count == 0 or count == 2 then
humrp= player.Character.RightHand
else
humrp= player.Character.LeftHand
end
local NewBullet = Clones:WaitForChild("DarkMatterBullet"):Clone()
NewBullet.Parent = BulletFolder
NewBullet.CFrame = humrp.CFrame + humrp.CFrame.LookVector
NewBullet.CFrame = CFrame.new(NewBullet.CFrame.p,mousePos)
local soundFX = RS.SoundFX:WaitForChild("DarkMatterBullet"):Clone()
soundFX.Parent = NewBullet
soundFX:Play()
soundFX.Ended:Connect(function()
soundFX:Destroy()
end)
local BV = Instance.new("BodyVelocity",NewBullet)
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity = NewBullet.CFrame.LookVector * 400
BV.P = math.huge
delay(0.25,function()
NewBullet:Destroy()
end)
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {humrp.Parent, BulletFolder}
Params.FilterType = Enum.RaycastFilterType.Blacklist
local result = workspace:Raycast(NewBullet.Position,NewBullet.CFrame.LookVector * 100,Params)
if result then
local part = result.Instance
print(part)
local humanoid = part.Parent:FindFirstChild("Humanoid") or part.Parent.Parent:FindFirstChild("Humanoid")
if humanoid and part.Parent:FindFirstChild("Safe") == nil then
humanoid.Health -= 10
local char:Model = part.Parent
if char.UpperTorso:FindFirstChild("BulletBlast") then
else
local VFX = Clones.Particles.AttatchmentContainer.BulletBlast:Clone()
VFX.Parent = char.UpperTorso
VFX.Name = "BulletBlast"
VFX.ParticleEmitter:Emit(1)
game.Debris:AddItem(VFX,EffectCD)
--local VFX = Clones.Particles.BulletBlastVFX:Clone()
--VFX.Parent = char.UpperTorso
--VFX.CFrame = char.UpperTorso.CFrame
--VFX.Name = "BulletBlast"
--local weld = Instance.new("WeldConstraint")
-- weld.Parent = VFX
-- weld.Part0 = VFX
-- weld.Part1 = char.UpperTorso
-- game.Debris:AddItem(VFX,EffectCD)
--end
end
local player:Player = game.Players:GetPlayerFromCharacter(char)
if player then
local Event = RS.Functions.ScreenChange
Event:FireClient(player,24, Color3.fromRGB(72, 36, 108), EffectCD)
end
end
if not result then
end
end
end
local count = 0
local OriginalFire = os.time()
BulletBlastRemote.OnServerEvent:Connect(function(player,mousePos,dmg,staminaCost)
local animation = nil
if count == 0 or count == 2 then
animation = RS:WaitForChild("Anims"):WaitForChild("RightThrow")
elseif count == 1 then
animation = RS:WaitForChild("Anims"):WaitForChild("LeftThrow")
else
animation = nil
end
if animation ~= nil then
local anim:AnimationTrack = player.Character.Humanoid:LoadAnimation(animation)
anim:Play()--anim:AdjustSpeed(0.5)
end
wait(0.1)
if count == 0 then
OriginalFire = os.time()
end
if count < 3 then
local CurrentFire = os.time()
if (CurrentFire - OriginalFire) < 3 then
Bullet(player,mousePos,dmg)
count += 1
BulletBlastRemote:FireClient(player)
else
count = 0
BulletBlastRemote:FireClient(player,true)
end
else
count = 0
BulletBlastRemote:FireClient(player,true)
end
end)