Teleport or Move player to a fixed location AND remove the momentum

  1. What do you want to achieve? When a player falls off a cliff, and collides with a big invisible block, I want to teleport (or move) the player back to a specific spot on the cliff. However, I want to do this with the player having no momentum. So player velocity would be reset to zero.

  2. What is the issue? When the player falls, then gets moved (teleported) back to the cliff top, the player inherits the movement, momentum, or velocity, and then sometimes flings into the air because of this. I do not want the player to fling. I want the player to appear at the cliff top at a non falling momentum - just normal at rest.

  3. What solutions have you tried so far? I’ve looked for solutions. I am having trouble phrasing the question to get results that help me.

Please see below code I am using. Thank you.

local part = script.Parent
local damage = 25
local DB = false
local OuchSFXEvent = game.ReplicatedStorage.Remotes.OuchSFXEvent


local function teleport(bodyPart)
		
	if DB == false then
		
		DB = true
		
		local humanoid = bodyPart.Parent:FindFirstChild('Humanoid')
		if humanoid then
			bodyPart.Parent.HumanoidRootPart.CFrame = script.Parent.Parent.SpawnLocation.CFrame
			if humanoid.Health > 0 then
				humanoid:TakeDamage(damage)
				local player = game:GetService("Players"):GetPlayerFromCharacter(bodyPart.Parent)
				OuchSFXEvent:FireClient(player)
			end

		end	
		
		wait(.5)
		DB = false
	end

end
	
part.Touched:Connect(teleport)

bodyPart.Parent.HumanoidRootPart.CFrame = script.Parent.Parent.SpawnLocation.CFrame
bodyPart.Parent.HumanoidRootPart.AssemblyLinearVelocity = Vector3.new()–reset linear velocity
bodyPart.Parent.HumanoidRootPart.AssemblyAngularVelocity = Vector3.new()–reset rotation velocity

1 Like

Thank you crazyzk. Testing now. I’ll report back soon.

@ crayzk_RBX Works like a charm!! Tested and just published a game update with this. Thank you for taking the time to help!!

1 Like