Im making a Homing rocket launcher (Using Rocket Propulsion) but only the first missile explodes and all following missiles just put the target around. Any help would be appreciated. I figured the local script would be unneeded but if requested i will give it.
Heres the asset for the launcher if you want to try out: https://www.roblox.com/catalog/3094113747
My code:
Initial Variables
local Tool = script.Parent
local Remote = Tool:WaitForChild("RemoteEvent")
local Handle = Tool.Handle
ServerEvent
Remote.OnServerEvent:Connect(function(Player,TargetChar)
print(TargetChar.Name)
local Head = TargetChar:WaitForChild("Head")
local Missle = Instance.new("Part")
Missle.Name = TargetChar.Name.."Missle"
Missle.Size = Vector3.new(2,2,6)
Missle.Material = Enum.Material.Neon
Missle.BrickColor = BrickColor.Red()
Missle.Position = Handle.Position
Missle.CanCollide = true
--//The Rocket Propulsion
local Send = Instance.new("RocketPropulsion")
Send.CartoonFactor = .7
Send.Target = Head
Send.MaxSpeed = 200
Send.MaxThrust = 100000 * 2
Send.Parent = Missle
Missle.Parent = game.Workspace
Send:Fire()
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://3094021580"
local Play = Player.Character.Humanoid:LoadAnimation(Anim)
Play:Play()
if Play.IsPlaying == true then
Handle.P.Transparency = NumberSequence.new(0, 0)
Handle.P.Transparency = NumberSequence.new(1, 0)
wait(Play.Length)
Handle.P.Transparency = NumberSequence.new(0, 1)
Handle.P.Transparency = NumberSequence.new(1, 1)
end
--// V this is where i think my issues are
Send.ReachedTarget:Connect(function()
local EX = Instance.new("Explosion")
EX.Position = Missle.Position
EX.Parent = Missle
wait(.5)
Missle:Destroy()
end)
end)
