Disabling all vectors?

I’m trying to make a script which teleports the player through a portal after sliding down a slide, however after completing the slide, the vector from the slide stays within the character and “flings” the character away from the finishing area (as seen in this video):

What can I do to make it so that the player doesn’t get “flung” like this after being teleported through the portal?

I tried resetting the character and anchoring the root part for a second after being teleported, to no avail.

Here’s the script managing the portal:

local TeleportPart1 = script.Parent.TeleportPart1
local TeleportPart2 = script.Parent.TeleportPart2

TeleportPart1.Touched:Connect(function(hit)
	local w = hit.Parent:FindFirstChild("HumanoidRootPart")
	if w then
		
		w.CFrame = TeleportPart2.CFrame + Vector3.new(0, 5, 0)
		TeleportPart2.CanTouch = false
		
		wait(1)
		
		TeleportPart2.CanTouch = true
		
	end
end)
2 Likes

You can just set .AssemblyLinearVelocity to Vector3.zero.

Code:

local TeleportPart1 = script.Parent.TeleportPart1
local TeleportPart2 = script.Parent.TeleportPart2

TeleportPart1.Touched:Connect(function(hit)
	local humanoidRootPart = hit.Parent:FindFirstChild("HumanoidRootPart")

	if humanoidRootPart then
		humanoidRootPart.CFrame = TeleportPart2.CFrame + Vector3.new(0, 5, 0)
		humanoidRootPart.AssemblyLinearVelocity = Vector3.zero

		TeleportPart2.CanTouch = false
		
		task.wait(1)
		TeleportPart2.CanTouch = true
	end
end)
2 Likes

You should look at replies before posting a duplicate.

2 Likes

oh gosh ur right sorry for the inconvenience :heart_hands:

2 Likes

It’s all good.

2 Likes

lol the mini drama, I’ll test out the code later (when Roblox is back up)

1 Like

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