Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Rocket Propulsion Target Question?

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)

2 comments

0

Well it depends on what character you want to propel and when...

0

I want it to go to my player and the time doesn't matter

1 answer

✓ Accepted answer
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.

This discussion is preserved as it was. New answers, comments, and votes are closed.