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

Homing Missile Function Not Working?

Asked by 4 years ago
01local rocket = script.Parent
02 
03if rocket.Parent == workspace then
04    for i = 1, 50 do
05        wait(0.03)
06        rocket.Position = rocket.Position + Vector3.new(0, 0.5, 0)
07    end
08end
09local randomPlayer = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
10print(randomPlayer)
11script.Parent:WaitForChild("RocketPropulsion").Target = randomPlayer.Character.HumanoidRootPart
12script.Parent:WaitForChild("RocketPropulsion"):fire()
13rocket.Touched:Connect(function(hit)
14    if hit ~= rocket and not rocket.Parent:FindFirstChild(hit.Name) then
15        local explode = Instance.new("Explosion")
16        explode.Parent = workspace
17        explode.Position = rocket.Position
18        rocket:Destroy()
19        end
20end)

The Start is too make the Missile Move Upwards but after that the line

1local randomPlayer = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]

and after that doesn't run Its also a normal script under the rocket/missile

0
what is the rocked parent? Necro_las 412 — 4y
0
workspace Brockanthony10 19 — 4y

Answer this question