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?

local ship = script.Parent
local PP = script.Parent.PrimaryPart

function sink()
    while true do
        for i= 1,1000000 do
            ship:SetPrimaryPartCFrame(PP.CFrame * CFrame.new(PP.CFrame * Vector3.new(0,-0.01,0)))
            wait()
        end
    end
end

game.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..


local ship = script.Parent local PP = script.Parent.PrimaryPart function sink() for i= 1,1000000 do wait() ship:SetPrimaryPartCFrame(PP.CFrame + Vector3.new(0, -0.01, 0) ) -- decreaces the y axis by -0.01 end end sink()
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