Cannot move only position of the CFrame

I wanted to make vaulting,i needed to change the CFrame because with position it freaked out,but when i tried that the orientation wasn’t right
My head is aching from this simple problem and i don’t know what to do

Heres the part of the script that responds for the CFrame changing

	local function Vault(rayht)
		plr.Character.HumanoidRootPart.Anchored = true
		ReplicatedStorage.Events.Movement.VaultNJump.StartVault:FireServer()
		local Tween = TweenService:Create(HRP,TweenInfo.new(.1),{["CFrame"] = CFrame.new(Vector3.new(rayht.Position.X,rayht.Position.Y + rayht.Instance.Size.Y,rayht.Position.Z),HRP.Orientation)})
		Tween:Play()
		Tween.Completed:Wait()
        task.wait(2)
		
		local TweenVector = TweenService:Create(HRP,TweenInfo.new(.1),{["CFrame"] = HRP.CFrame + Vector3.new(HRP.CFrame.LookVector.X,0,HRP.CFrame.LookVector.Z) * 10})
		TweenVector:Play()
		TweenVector.Completed:Wait()
		
		task.wait(2)
		Tween = TweenService:Create(HRP,TweenInfo.new(.1),{["CFrame"] = HRP.CFrame + Vector3.new(0,-rayht.Instance.Size,0)})
		Tween:Play()
		Tween.Completed:Wait()
		

		ReplicatedStorage.Events.Movement.VaultNJump.VaultEnded:FireServer()
		plr.Character.HumanoidRootPart.Anchored = false
	end

Heres a video of the problem


(I couldn’t find anything on forums,probably because i cannot really write anything that actually makes sense in the searchbar,sorry)

How do i move only the position?
Thanks in advance.

It gives an error
"TweenService:Create property named ‘CFrame’ cannot be tweened due to type mismatch (property is a ‘CoordinateFrame’, but given type is ‘Vector3’) "

Size, is a Vector3, so make sure you specify what Axis you need, or just say + Size

I’m pretty sure TweenService does not update this value while tweening, TweenService is also likely conflicting with the Roblox physics engine on where exactly the player should be

It’s good practice to use a Mover Constraint on the RootPart instead, as it achieves the same effect

oof,sounds and looks scary,is there any alternative?

As an alternative, you could just use
AlignPosition | Documentation - Roblox Creator Hub
and calculate the wanted position, it kinda works like tweens.

TweenService can update this value while Tweening, and CFrame can be used to move the Model because of its Weld’s, It cant move properly using Position, but CFrame should work as intended for both cases.

It’s actually really simple when you get into it, this will actually be easier than trying to tween a cframe with physics without anchoring the part either, since you wont have to worry about physics messing up the path of the player, making jerking and jittering motions

This is what i just said.

Do i basically need to create hitboxes and make an attachment inside those hitboxes and the HRP?

Since I’m not 100% educated on how exactly your vaulting system works, ill just give you a generic rundown on how these things are used

Basically, you insert this into a part, imagine a Magnet and a piece of metal, your RootPart is the metal and the part you want it to go to is the Magnet, the magnet pulls the RootPart towards it. You create two attachments, one located where you want the magnet to be (Attachment1) and what you want it to pull to be (Attachment0) by default.

Of course, im referring to AlignPosition which is what i hopefully linked a tutorial to above (Im aware it includes other similar constraints)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.