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

How to stop my boat collapsing?

Asked by 4 years ago
Edited 4 years ago

I have this script that is meant to make my boat move along the z axis. However, once it starts moving, all the pats suddenly compile together into one space. My script includes all of the parts of the boat to move separately, yet in sync. Here's my script.

BP = script.Parent.BP
BP1 = script.Parent.BP1
BP2 = script.Parent.BP2
BP3 = script.Parent.BP3
BP4 = script.Parent.BP4
BP5 = script.Parent.BP5
BP6 = script.Parent.BP6
BP7 = script.Parent.BP7
BP8 = script.Parent.BP8
BP9 = script.Parent.BP9
BP10 = script.Parent.BP10
BP11 = script.Parent.BP11
BP12 = script.Parent.BP12
BP13 = script.Parent.BP13
FMove = 0
LMove = 0
RMove = 0
BMove = 0

wait(15)
repeat
    BP.Position = Vector3.new(0,0,FMove)
    BP1.Position = Vector3.new(0,0,FMove)
    BP2.Position = Vector3.new(0,0,FMove)
    BP3.Position = Vector3.new(0,0,FMove)
    BP4.Position = Vector3.new(0,0,FMove)
    BP5.Position = Vector3.new(0,0,FMove)
    BP6.Position = Vector3.new(0,0,FMove)
    BP7.Position = Vector3.new(0,0,FMove)
    BP8.Position = Vector3.new(0,0,FMove)
    BP9.Position = Vector3.new(0,0,FMove)
    BP10.Position = Vector3.new(0,0,FMove)
    BP11.Position = Vector3.new(0,0,FMove)
    BP12.Position = Vector3.new(0,0,FMove)
    BP13.Position = Vector3.new(0,0,FMove)
    wait(.1)
    FMove = FMove+3.5
until false

Side problem: The boat doesn't bring the character with it.

I'll include pictures of the boat here: https://docs.google.com/document/d/19lfhZW3vBbjHGzoqKnOWIa6Dhg_ALypB3G0CNk0823E/edit

0
They compile into one space because you set them all into the same position. To make things move, there is a wayyy more efficient way, wich is using tweenservice. https://developer.roblox.com/en-us/api-reference/class/TweenService User#32819 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

It's because you set all your boat parts position to

Vector3.new(0,0,FMove)

meaning that every part change position into the same single position

So instead write these

BP.Position = BP.Position + Vector3.new(0,0,FMove)
BP1.Position = BP1.Position + Vector3.new(0,0,FMove)
BP2.Position = BP2.Position + Vector3.new(0,0,FMove)
-- And so on

There are a lot of way to move your boats more efficiently, but i feel like you don't have sufficient knowledge yet, so keep on learning!

Ad

Answer this question