Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make this homing projectile?

Asked by 2 years ago

I've been trying to make a homing bullet simular to the one in cuphead yall get the idea

code:

local TS = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(
    1,
    Enum.EasingStyle.Sine,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)


for i,v in pairs(game.Workspace:GetChildren()) do
    if v:FindFirstChild("Humanoid") then
        if not game.Players:FindFirstChild(v.Name) then
            local target = v
            local tween = TS:Create(script.Parent, tweeninfo,  {Position = target.HumanoidRootPart.Position})
            tween:Play()
        end
    end
end

wait(5)
script.Parent:Destroy()

1 answer

Log in to vote
0
Answered by
SuperPuiu 497 Moderation Voter
2 years ago

G'day! Like you, I don't have much experience in homing missiles, but I did a simple google search and found this: RocketPropultion

The RocketPropulsion object applies a force on a part so that it both follows and faces a target part. It acts like a hybrid of BodyPosition and BodyGyro. Unlike other BodyMovers, a RocketPropulsion must be instructed to begin applying a force: call Fire to start, or call Abort to stop.

Hope it helped, SuperPuiu.

0
I'll check into it but I want it to follow the nearest non-player character KamKam_AJHasBeenBan 37 — 2y
0
It works for anything, it just have to be a block, read the article I put SuperPuiu 497 — 2y
Ad

Answer this question