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

Why is this shuttle script not teleporting my player with it?

-- THIS IS A NORMAL SCRIPT, NOT LOCAL, INSIDE OF A SURFACEGUI
function moveShuttle(cf)
	model:SetPrimaryPartCFrame(cf)
	local x = game.Players:GetChildren()
	for i = 1,#x do
		print("Scanning " .. x[i].Name)
		if x[i].Backpack.InShuttle.Value == true then
			print(x[i].Name .. " is inside shuttle")
			local xchar = x[i].Character
			local tor = xchar.Torso
			local diff = (tor.Position-model.MainPart.Position)
			local cframe = cf+diff
			local rotcf = CFrame.Angles(math.rad(tor.Rotation.X),math.rad(tor.Rotation.Y),math.rad(tor.Rotation.Z))
			tor.CFrame = cframe * rotcf -- THIS BASTARD HERE DOESNT WANT TO WORK
		end
	end
end
-- NOTE THIS IS JUST ONE FUNCTION, IF YOU WOULD LIKE ME TO EDIT IN THE WHOLE SCRIPT PLEASE TELL ME

So I'm trying to make a script that moves a shuttle in space, and if you're inside of it you move with it, everything is working fine except for the part that sets my character's Torso CFrame.

It doesn't do anything. Nothing. It's confusing me and is frustrating as hell. If any of you have a solution or can see what I'm doing wrong, I would love to hear it.

Also, no, no errors come up.

1 answer

Okay I now realize I am mentally deficient. I was defining the "diff" variable after the shuttle moved, so basically I'm telling the script to put me in the exact same spot I was before the shuttle moved. Facepalm of facepalms.

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