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

Help on rocket propulsion script?

Asked by
Mystdar 352 Moderation Voter
9 years ago

So what I would like is that when you Touch part an arrow will travel across towards a part called locator1 but it just doesn't work and there is no Output telling me what has happened, either, just nothing occurs. This is what I have so far: (This is in the part you touch)

function onTouched(hit) -- When you touch the part
if hit.Parent:findFirstChild("Humanoid") then -- Verify that a actual player hit it
local Shaft = game.Workspace.Arrow.Shaft -- Declare what Shaft is
Shaft.RocketPropulsion:fire()-- Fire Shaft
wait (20) -- Wait 20 seconds
Shaft.CFrame = CFrame.new(-8.5, 3.5, -0.5) --Put Shaft back to where it was
end
end

Then inside the Arrow there is a block called Shaft which has all the other parts welded to it. This script is inside the Shaft. (Shaft is a child of the arrow)

local RP = Instance.new('RocketPropulsion', game.Workspace.Arrow.Shaft) -- I think the parenting here might be off, script.parent was what I had before, and that didn't work.
RP.Target = game.Workspace.locator1 --This is the part the arrow travels towards
RP.MaxSpeed = 100 --Change the Shaft's speed Speed
RP.CartoonFactor = 0 -- This makes the shaft point towards a target

1 answer

Log in to vote
0
Answered by 3 years ago

i know this is kinda late (6 yrs late) but i think i know the problem.

READ THE LINES BELOW READ THIS LINE: the most likely problem is: you never said when to run ontouched, you need to do script.Parent.Touched:Connect(onTouched) after it. READ THE LINES ABOVE

1st, it could be that the arrow glitches and moves across the map so you dont see it travel. 2nd possibility, if the arrow does not have enough mass, it will glitch out and fly out of the game. 3rd possibility, you might not have the speed set high enough or to high 4th possibility, you might not have set the target part for the rocket propulsion. 5th possibility, rocket propulsions only work on one part, try to union them (most likely) 6th possibility, yea your parenting is wrong, the rocket propulsion should always be in the part you want to propel and the 7th possibility, when you are trying to get a part with numbers in its name, it shouldnt be "game.Workspace.locator1" it should be "game.Workspace["locator1"]

there was one more possibility but i forgot it because i was writing so much (sorry)

also you should try to union both items, because in my experience they will only travel together if it is one part.

to fix 2 you would need a bigger arrow

an example that would fix 1,3,4 would be like this:

shaft = game.Workspace.shaft function onTouched(hit) local Player = hit.Parent local Human = Player:FindFirstChild("Humanoid") if Human then local shaft2 = shaft:Clone() shaft2.Parent = game.Workspace shaft2.Position = LAUNCHER.Position local rocket = Instance.New("RocketPropulsion") rocket.Parent = shaft rocket.Target = game.Workspace["locator1"] rocket:Fire() end end script.Parent.Touched:Connect:(onTouched)

0
oof my script didnt come out correctly :\ flrrrrpp 0 — 3y
Ad

Answer this question