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

Vector3 Makes the ship get flung?

Asked by 5 years ago
Edited 5 years ago

I've been trying to code a sinking ship, still not done yet, im working in the moving part.

Although, when i click the button to run the script, the thing nopes out of there and goes into low earth orbit. Anything i need to change?

01local ship = script.Parent
02local PP = script.Parent.PrimaryPart
03 
04function sink()
05    while true do
06        for i= 1,1000000 do
07            ship:SetPrimaryPartCFrame(PP.CFrame * CFrame.new(PP.CFrame * Vector3.new(0,-0.01,0)))
08            wait()
09        end
10    end
11end
12 
13game.Workspace.button.ClickDetector.MouseClick:Connect(sink)

~~~~~~~~~~~~~~~~~

0
Is the ship anchored? mudathir2007 157 — 5y
0
yes. MradmannMvip 50 — 5y
0
Can the block that the ship sinks in collide? if so then set can collide of the water to off, see if that works mudathir2007 157 — 5y
0
it didnt MradmannMvip 50 — 5y

1 answer

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

Try using..

01local ship = script.Parent
02local PP = script.Parent.PrimaryPart
03 
04function sink()
05     for i= 1,1000000 do
06    wait()
07    ship:SetPrimaryPartCFrame(PP.CFrame + Vector3.new(0, -0.01, 0) ) -- decreaces the y axis by -0.01
08    end
09end
10 
11sink()
0
also you can mess with the numbers if you want faster sinking. mudathir2007 157 — 5y
0
tysm MradmannMvip 50 — 5y
Ad

Answer this question