Fireball object doesnt follow fireball position

im trying to make a fireball item, however, when i fire it, the fireball part its self stays still while the fireball moves. the object is unanchored and can collide is off

game.ReplicatedStorage.FireballEvent.OnServerEvent:Connect(function(player)

local clonedFireball = game.ReplicatedStorage.Fireball:Clone()
local CF = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0.5, -4)

clonedFireball.Parent = workspace
clonedFireball.CFrame = CF

local BodyVelocity = Instance.new(“BodyVelocity”)
BodyVelocity.Parent = clonedFireball
BodyVelocity.Velocity = player.character.HumanoidRootPart.CFrame.lookVector * 100

clonedFireball.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) and not hit:IsDescendantOf(player.Character) then
if not player then
hit.Parent.Humanoid:TakeDamage(40)
clonedFireball:Destroy()
end
elseif not hit.Parent:FindFirstChild(“Humanoid”) then
local Explosion = Instance.new(“Explosion”)
Explosion.Parent = workspace
Explosion.ExplosionType = Enum.ExplosionType.NoCraters
Explosion.BlastRadius = 3
Explosion.DestroyJointRadiusPercent = 0
Explosion.Position = clonedFireball.Position
clonedFireball:Destroy()
end
end)
end)

1 Like

Hi, try this

game.ReplicatedStorage.FireballEvent.OnServerEvent:Connect(function(player)
    local clonedFireball = game.ReplicatedStorage.Fireball:Clone()
    local CF = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0.5, -4)

    clonedFireball.Parent = workspace
    clonedFireball.CFrame = CF

    local BodyVelocity = Instance.new("BodyVelocity")
    BodyVelocity.Parent = clonedFireball
    BodyVelocity.Velocity = player.Character.HumanoidRootPart.CFrame.lookVector * 100

    -- Anchor the fireball's visual part to its BodyVelocity
    clonedFireball.Anchored = true
    BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge) -- Ensure the velocity is not capped

    clonedFireball.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") and not hit:IsDescendantOf(player.Character) then
            if not player then
                hit.Parent.Humanoid:TakeDamage(40)
                clonedFireball:Destroy()
            end
        elseif not hit.Parent:FindFirstChild("Humanoid") then
            local Explosion = Instance.new("Explosion")
            Explosion.Parent = workspace
            Explosion.ExplosionType = Enum.ExplosionType.NoCraters
            Explosion.BlastRadius = 3
            Explosion.DestroyJointRadiusPercent = 0
            Explosion.Position = clonedFireball.Position
            clonedFireball:Destroy()
        end
    end)
end)

now the body velocity doesnt move

oh yes sorry delete this

clonedFireball.Anchored = true

okay so the velocity moves again but its back to the start where the part just stays there

game.ReplicatedStorage.FireballEvent.OnServerEvent:Connect(function(player)
    print("Creating fireball for player:", player.Name)

    local clonedFireball = game.ReplicatedStorage.Fireball:Clone()
    local CF = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0.5, -4)

    clonedFireball.Parent = workspace
    clonedFireball.CFrame = CF

    print("Fireball position set.")

    local BodyVelocity = Instance.new("BodyVelocity")
    BodyVelocity.Velocity = player.Character.HumanoidRootPart.CFrame.lookVector * 100
    BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
    BodyVelocity.Parent = clonedFireball

    print("Fireball velocity set.")

    clonedFireball.Touched:Connect(function(hit)
        print("Fireball touched something.")

        if hit.Parent:FindFirstChild("Humanoid") and not hit:IsDescendantOf(player.Character) then
            if not player then
                hit.Parent.Humanoid:TakeDamage(40)
                clonedFireball:Destroy()
            end
        elseif not hit.Parent:FindFirstChild("Humanoid") then
            local Explosion = Instance.new("Explosion")
            Explosion.Parent = workspace
            Explosion.ExplosionType = Enum.ExplosionType.NoCraters
            Explosion.BlastRadius = 3
            Explosion.DestroyJointRadiusPercent = 0
            Explosion.Position = clonedFireball.Position
            clonedFireball:Destroy()
        end
    end)
end)


try this and tell me what u see in ur output

1 Like

the same problem with the fireball ?

yea, its just sitting there while its velocity fires

1 Like

can u rec again with the output ?

1 second, i got to fix the video

1 Like

1 Like

Okay, so the fireball starts moving after you touch it, can I see your LocalScript?

sure

local player = game.Players.LocalPlayer
local Fireball = player:WaitForChild(“Backpack”).Fireball
local BallEvent = game.ReplicatedStorage.FireballEvent
local Debounce = false
local Cooldown = 0.5 – Change number to change cooldown
local mouse = player:GetMouse()
local inputservice = game:GetService(“UserInputService”)

inputservice.InputBegan:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.E and not gpe then
if player.Character:FindFirstChild(“Fireball”) and player.Character[“Fireball”]:IsA(“Tool”) then

		if Debounce == false then
			
			Debounce = true
			BallEvent:FireServer(mouse.Hit.p)
		
			wait(Cooldown)
			Debounce = false
		end

	end

end

end)

1 Like

Try using LinearVelocity, since BodyVelocity is deprecated and shouldn’t be used anymore.

Try this, it should work

game.ReplicatedStorage.FireballEvent.OnServerEvent:Connect(function(player, targetPosition)
    print("Creating fireball for player:", player.Name)

    local clonedFireball = game.ReplicatedStorage.Fireball:Clone()
    local CF = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0.5, -4)

    clonedFireball.Parent = workspace
    clonedFireball.CFrame = CF

    print("Fireball position set.")

    local velocityDirection = (targetPosition - clonedFireball.Position).unit

    local LinearVelocity = Instance.new("LinearVelocity")
    LinearVelocity.LineVelocity = velocityDirection * 100
    LinearVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
    LinearVelocity.Parent = clonedFireball

    print("Fireball velocity set.")

    clonedFireball.Touched:Connect(function(hit)
        print("Fireball touched something.")

        if hit.Parent:FindFirstChild("Humanoid") and not hit:IsDescendantOf(player.Character) then
            if not player then
                hit.Parent.Humanoid:TakeDamage(40)
                clonedFireball:Destroy()
            end
        elseif not hit.Parent:FindFirstChild("Humanoid") then
            local Explosion = Instance.new("Explosion")
            Explosion.Parent = workspace
            Explosion.ExplosionType = Enum.ExplosionType.NoCraters
            Explosion.BlastRadius = 3
            Explosion.DestroyJointRadiusPercent = 0
            Explosion.Position = clonedFireball.Position
            clonedFireball:Destroy()
        end
    end)
end)

1 Like

now it just blows up after a second by its self and on line 16 it says value cannot be converted to number

1 Like

We actually don’t need LinearVelocity.MaxForce. And we can just set LinearVelocity.ForceLimitsEnabled to false.

LinearVelocity.VectorVelocity = velocityDirection * 100
LinearVelocity.ForceLimitsEnabled = false
LinearVelocity.Parent = clonedFireball

Also, LinearVelocity requires an Attachment. So you need to add one and set LinearVelocity.Attachment0 to that attachment.

2 Likes

for some reason, the attatchment i added doesnt have the attatchment 0 and 1 properties

1 Like

Sorry, you might have been misunderstood. I meant LinearVelocity.Attachment0, not Attachment.Attachment0

1 Like