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!
Im making a 1 and 15 chance of having the bullet making an explosion
- What is the issue? Include screenshots / videos if possible!
After the random value lands on ‘1’ the gun will fire explosive bullets forever, instead of doing it once.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i tried removing the event, but then got a vector3 error with ‘position’. i tried having a remote event made for the mouse position so i can gather the position for the explosion but i kept running into errors.
local config = require(assets.Config)
if config.thunderPaP == true then
local random = math.random(1, 15)
print (random)
if random == 1 then
random = 2
Evt.HitEffect.OnServerEvent:Connect(function(plr,trg,dmg, Position)
print ("thunder effect")
script.Parent.Assets.Special.TG:Play()
local explo = Instance.new("Explosion", workspace)
explo.Visible = true
explo.BlastRadius = 100
explo.BlastPressure = 0
explo.DestroyJointRadiusPercent = 0
explo.ExplosionType = Enum.ExplosionType.NoCraters
explo.Position = Position
game.Debris:AddItem(explo, 2)
explo.Hit:Connect(function(hitpart)
if hitpart.Name == "Head" and hitpart.Parent:FindFirstChild("Humanoid") then
local cChr = hitpart.Parent
local cPlr = game.Players:GetPlayerFromCharacter(cChr)
local dist = (cChr.HumanoidRootPart.Position).Magnitude
local MaxZone = config.ExplosionRadius
local MinZone = MaxZone / 3
local dmg = math.huge
if cChr.Name == "Vertition's Soul" then
--print(cChr)
else
if not cPlr or cPlr == plr then
local skp_t = Instance.new("ObjectValue")
skp_t.Name = "creator"
skp_t.Value = plr
skp_t.Parent= cChr.Humanoid
game.Debris:AddItem(skp_t, 1)
if dist < config.ExplosionRadius / 3 then
if cChr.Name == "Zombie" then
cChr.Humanoid.Health = cChr.Humanoid.Health - dmg
print "too close"
else
print "Player"
end
end
end
end
end
end)
--Explosion fx
local effectAtt = Instance.new("Attachment",workspace.Terrain)
effectAtt.WorldCFrame = CFrame.new(Position)
end)
else
dmg = dmg * plr.Character.Variables.DoubleTap.Value
trg.Parent.Humanoid:TakeDamage(dmg)
bleed()
end
else
dmg = dmg * plr.Character.Variables.DoubleTap.Value
trg.Parent.Humanoid:TakeDamage(dmg)
print (dmg)
bleed()
end