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

how would I send a model flying into the air on the y-axis the player touches a part?

Hello There I am New to this site but have been playing Roblox since the summer of 2006 but anyway i have been trying to get one of those old rockets off the ground again and it would seem that the rocket propulsion object could be the answer i know this is very old code but how would i change this script in such a way that it would work again?

local engine = script.Parent.Parent.Engine
local bodyforce = engine.BodyForce
local retractor = script.Parent.Parent.Retracter



local debounce = false




function onTouched(hit)
	local humanoid = hit.Parent:findFirstChild("Humanoid")
	if humanoid~=nil and debounce == false then
		debounce = true
		
		retractor.CanCollide = false

		script.Parent.BrickColor = BrickColor.new(21)

		
			
		bodyforce.force = Vector3.new(0,600000,0)
		wait(8)
		
		--bodyforce.force = Vector3.new(math.random(-10000,10000),math.random(-10000,10000),math.random(-10000,10000))
		--wait(.5)

		bodyforce.force = Vector3.new(0,0,0)

			
	

		script.Parent.BrickColor = BrickColor.new(28)

		wait(1)
	
		
		retractor.CanCollide = true

		debounce = false
	end
end


script.Parent.Touched:connect(onTouched)



1 comment

0

Maybe try uncommenting (removing the double dashes) from lines 26 and 27?

2 answers

The only problem I see is the way you're changing the BrickColor on lines 19 and 34. Your parameter should be a string, not a number. Example:

script.Parent.BrickColor = BrickColor.new("Really red")

1 comment

0

It does not matter, the way he did it works fine.

A BodyForce cannot apply torque to an object. If you are looking to move an object, I would recommend a BodyVelocity. Try switching to a BodyVelocity and see if that fixes your issue.

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