And in other news, Tween Player - Myth or Mystery?

I’ve seen claims that tweening the player is possible here, here, here, and here.

But having thoroughly scoured these threads and other resources and stripping the implementation down to the bare essentials, I have yet to see tweening do anything other than things like this - player jitters, camera tracking is off:

“The bare essentials” means this is in an empty, new baseplate project with exactly two scripts and a part. Here it is.
player-tween-jitter.rbxl (38.9 KB)

If you don’t want to bother with that, here is the entirety of the implementation (not much to it)
Server sends remote event sent when player touches part:

local ReplicatedStorage 	= game:GetService("ReplicatedStorage")
local Players 				= game:GetService("Players")

local TweenPlayer 	= ReplicatedStorage:WaitForChild("TweenPlayer")

local Part = script.Parent

local DebouncePerPlayer = {}

Part.Touched:Connect(function(touched)
	local player = Players:GetPlayerFromCharacter(touched.Parent)
	if not player then return end

	if DebouncePerPlayer[player.UserId] then return end
	DebouncePerPlayer[player.UserId] = true

	TweenPlayer:FireClient(player)

	wait(5)
	DebouncePerPlayer[player.UserId] = nil
end)

Local script receives event and creates tween:

local ReplicatedStorage 	= game:GetService("ReplicatedStorage")
local Players 				= game:GetService("Players")
local TweenService			= game:GetService("TweenService")
local Debris				= game:GetService("Debris")

local TweenPlayer			= ReplicatedStorage:WaitForChild("TweenPlayer")


local function anchorForTween(anchored, hrp)
	for _, child in pairs(hrp:GetDescendants()) do
		if child:IsA("BasePart") then
			child.Anchored = anchored
		end
	end
end

TweenPlayer.OnClientEvent:Connect(function(internalDisc)
	local character = Players.LocalPlayer.Character
	local hrp = character:FindFirstChild("HumanoidRootPart")	

	anchorForTween(true, hrp)

	-- tween up and over
	local dest = CFrame.new(
		Vector3.new(hrp.CFrame.Position.X + 20, hrp.CFrame.Position.Y + 20, hrp.CFrame.Position.Z + 20),
		hrp.CFrame.LookVector
	)
	local tween = TweenService:Create(
		hrp,
		TweenInfo.new(3, Enum.EasingStyle.Quad),
		{ CFrame = dest }
	)

	tween.Completed:Connect(function()
		Debris:AddItem(tween)
		anchorForTween(true, hrp)

		print("made it")
	end)

	tween:Play()

end)

Alternatives: run tween on server…
Despite some seemingly conflicting/confusing answers about whether this should be run on client or server, here the assertion is it must be done on the client (which is what I’m doing in the video and scripts linked). But trivial enough to do the same thing on the server and see it fail in much the same way, only slightly worse.

So, having worked on this problem off and on for the last week, I’m left wondering: has anyone ever successfully tweened the player or is doing so just a theoretical myth?

You can tween there is a missing thing though.

This function

local function anchorForTween(anchored, hrp)
	for _, child in pairs(hrp:GetDescendants()) do
		if child:IsA("BasePart") then
			child.Anchored = anchored
		end
	end
end

You only need one anchored part which is mandatory. I believe the issue is that the default script is confused which part is the root part which confuses the camera and such:

Only anchor the root part and bam its fixed:

You’re my hero for so many reasons. Thank you!

1 Like

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