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

Rocket Propulsion Target Question?

Asked by 8 years ago

How do i make my script go to a player instead of the part named Target?

local rp=Instance.new("RocketPropulsion")
rp.Parent=workspace.Part
rp.MaxSpeed=1000
rp.Target=workspace.Target <---- I know you change something here...
rp:fire()
function onTouch(hit)
    local f=Instance.new("Explosion")
    f.Parent=script.Parent
    f.Position=script.Parent.Position
    f.BlastPressure=500
    f.BlastRadius=500
end

script.Parent.Touched:connect(onTouch)
0
Well it depends on what character you want to propel and when... Perci1 4988 — 8y
0
I want it to go to my player and the time doesn't matter QuantumScripter 48 — 8y

1 answer

Log in to vote
1
Answered by
funyun 958 Moderation Voter
8 years ago
game.Players.PlayerAdded:connect(function(player) --When someone joins...
    player.CharacterAdded:connect(function(character) --And their character is loaded...
        local rp = Instance.new("RocketPropulsion", script.Parent) --RocketPropulsion in script.Parent
        rp.MaxTorque = Vector3.new(math.huge, math.huge, math.huge) --So the propulsion has infinite potential, and therefore is strong enough to lift the part off the ground.
        rp.Target = character.Torso --Set the target to his torso.
        rp:fire()
    end)
end)

function onTouch()

    --[[ Again, "hit" is totally unnecessary in the above line.
        This is only if we want to do something with the part that
        touched "script.Parent". We could then do hit:Destroy() or
        something like that.
    --]]

    local f = Instance.new("Explosion", script.Parent) --Again, shortcut for setting the parent.
    f.Position = script.Parent.Position
    f.BlastPressure = 500
    f.BlastRadius = 500
end

script.Parent.Touched:connect(onTouch)

...That should at least do what it's supposed to. If you do not get any of this, please remember that learning how to script takes time. You can't just learn this all at once. You just gradually move toward a better understanding of it. For now, keep things simple.

Ad

Answer this question