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

Vector3 Makes the ship get flung?

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)

4 comments

0

Is the ship anchored?

0

yes.

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

0

it didnt

1 answer

✓ Accepted answer

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()

2 comments

0

also you can mess with the numbers if you want faster sinking.

0

tysm

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