This script works perfectly fine when FE is disabled but breaks when I enable it.

It allows me to throw the grenade but it won't explode, rather it just rolls around without having any affect. Can anyone help me?

wait(2)

local maxDamage = 100

script.Parent.Transparency = 1

script.Parent.Effect1.Enabled = true
script.Parent.Light.Enabled = true
script.Parent.charge:Play()

ex = Instance.new("Explosion")
ex.BlastPressure = 0
ex.BlastRadius = 8
ex.ExplosionType = "NoCraters"
ex.Position = script.Parent.Position

ex.Hit:connect(function(hitPart, partDistance)
    local humanoid = hitPart.Parent and hitPart.Parent:FindFirstChild("Humanoid")
    if humanoid then
        local distance_factor = partDistance / ex.BlastRadius
        distance_factor = 1 - distance_factor
        humanoid:TakeDamage(maxDamage*distance_factor)
    end
end)

ex.Parent = game.Workspace

local mark = game.Lighting:FindFirstChild('BlastMark')
if mark then
	local mark = mark:clone()
	mark.Parent = game.Workspace
	mark.CFrame = CFrame.new(script.Parent.Position) * CFrame.new(0, -.45, 0)
	game.Debris:AddItem(mark, 8)
end

wait(.07)

script.Parent.Effect1.Enabled = false
script.Parent.Light.Enabled = false

game.Debris:AddItem(script.Parent, 1)

3 comments

0

Cant modify the server via a local script

0

^^ Like he said you're going to need a remote event

0

It's a regular script inside the tool