0

# Why wont the fireball do any damage?

Edited 1 month ago

I have a tool that when activated will shoot a fireball and when that collides with a player it will deal damage to the targets humanoid. This is a simulator game (like superpower training simulator) so the damage of the fireball will be different depending on the players fist strength but for some reason it doesn't deal any damage. Here's the script:

local Tool = script.Parent
local Cooldown = false
local CDTime = 1.5

Tool.RemoteEvent.OnServerEvent:Connect(function(Player,Mouse)
if Cooldown then return end

spawn(function()
Cooldown = true
wait(CDTime)
Cooldown = false
end)

local sphere = game.ReplicatedStorage.Abilities.EnergySphere.Sphere1:Clone()
sphere.Parent = game.Workspace
sphere.CFrame = CFrame.new(Position)
sphere.CanCollide = false
sphere.Anchored = false
sphere:SetNetworkOwner(Player)
local BodyVelocity = Instance.new("BodyVelocity",sphere)
BodyVelocity.Velocity = Mouse.lookVector * 50
BodyVelocity.MaxForce = Vector3.new(1e8,1e8,1e8)

sphere.Touched:Connect(function(hit)
if hit.Parent == Player.Character then return end
if hit and hit.Parent:FindFirstChild("Humanoid") then
local EnemyHum = hit.Parent:FindFirstChild("Humanoid")
Player.Data.Strength:GetPropertyChangedSignal("Value"):Connect(function()
EnemyHum:TakeDamage(Player.Data.Strength.Value)
end)
Tool.Explosion:Play()
sphere:Destroy()

end
end)
end)



1

There's lots of things about this code that is incorrect, but I'll go over the main topic

-- replace this for lines 32 - 35

if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid:TakeDamage(Player.Data.Strength.Value)
end


If this doesnt work, reply, I'll rewrite a completely new script.

0
Ok thanks, and I know there's probably alot of things wrong with it but until i tried this, everything worked well and fine so yeah. Sabertooth11123 38 — 1mo