How do you make a projectile?

Thanks but I guess I actually didn’t find the solution it still damages me when I fire it even though I fired it.

I mean you could just simply exclude the Character that cast the Fireball in the first place if you want that instead, that’d be easier to do

Okay but how so should I do this?

Since we have the Caster’s Character, we can just simply check if the Character that we hit is equal to the Caster or not

local FireballDamage = 25
local DB = false

Clone.Touched:Connect(function(Hit)
    local Target = game.Players:GetPlayerFromCharacter(Hit.Parent)

    if not DB and Target and Target ~= Character then
        local Character = Hit.Parent
        DB = true
        Character.Humanoid:TakeDamage(FireballDamage)
        wait(1)
        DB = false
    end
end)

Try this?

ServerScriptService.Fireball:32: Expected ‘end’ (to close ‘function’ at line 6), got ; did you forget to close ‘then’ at line 25?

You missed an end somewhere, this should be your full-on script?

--Server Script inside ServerScriptService
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local Fireball = game.ServerStorage:WaitForChild("Fireball")
local Speed = 80
local Offset = 10

Event.OnServerEvent:Connect(function(Player)
    local Character = Player.Character

    local Clone = Fireball:Clone()
    Clone.Parent = workspace
    Clone.Position = Character.HumanoidRootPart.Position + Character.HumanoidRootPart.CFrame.LookVector * Offset

    local BodyVel = Instance.new("BodyVelocity")
    BodyVel.Parent = Clone
    BodyVel.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

    BodyVel.Velocity = Character.HumanoidRootPart.CFrame.LookVector * Speed

    local FireballDamage = 25
    local DB = false

    Clone.Touched:Connect(function(Hit)
        local Target = game.Players:GetPlayerFromCharacter(Hit.Parent)

        if not DB and Target and Target ~= Player then
            local TargetChar = Hit.Parent
            DB = true
            TargetChar.Humanoid:TakeDamage(FireballDamage)
            wait(1)
            DB = false
        end
    end)

end)
1 Like

It still damages me :frowning: rip oof but if I move the offset which I did it works and really that’s all I need!

I hate overlapping variables

I edited it, can you please try again?

1 Like

In all honesty it didn’t work, but I don’t need it to work since when I was testing I set the offset to 0, but really I only need the offset to 5 so for me it’s an +A thanks for your help.

1 Like

Gotcha, well if you do need the script to not-detect the caster I (HOPEFULLY) fixed it this time

I was referencing 2 different things yet again, fun

It %100 works! Thanks for your help!

1 Like