The TweeningService not working on HumanoidRootPart!

Hello, novice scripter here.

I’ve been trying for hours trying to figure out how to freeze the player and tween it’s position up into the lava to kill the player. The client side seems fine, but the server side is wonky which I believe this is the reason why the player isn’t dying. I’ve tried to find solutions to this problem which I found a similar question on the DevForum.

His question was never answered. Anyways, I will leave videos below of both the client and server sides and the code block will be below.
~
~
CLIENT


~
~
SERVER

~
~
CODE

local awesomeness = script.Parent
local tween = game:GetService("TweenService")

awesomeness.Touched:Connect(function(bob)
	local johnny = bob.Parent
	local humanoid = johnny:FindFirstChild("Humanoid")
	if humanoid then
		local head = humanoid.Parent:FindFirstChild("HumanoidRootPart")
		head.Anchored = true

		local guy = TweenInfo.new(

			5, -- time
			Enum.EasingStyle.Quad, -- how it transitions
			Enum.EasingDirection.InOut, -- how the values speed up or slow down
			-1,
			false,
			0.01
		)
		local coolness = tween:Create(head, guy, {Position = head.Position + Vector3.new(0, 40, 0)})
		coolness:Play()
	end
end)

Thanks for anyone who helps! I’ve been using the forums recently lol.

Use CFrame to tween.

Tweening position or changing position only changes one part and not the assembly which causes it to be wonky.

local coolness = tween:Create(head, guy, {CFrame.Position == head.Position + Vector3.new(0, 40, 0)})

Did I place this wrong? Because it doesn’t work

You are doing an equivalent ==

Also you need to change the CFrame not the CFrame.Position

{CFrame = head.CFrame + Vector3.new(0, 40, 0) }

1 Like

I see! I changed that and added a unanchored line of code near the end and it solved my problems.

local awesomeness = script.Parent
local tween = game:GetService("TweenService")

awesomeness.Touched:Connect(function(bob)
	local johnny = bob.Parent
	local humanoid = johnny:FindFirstChild("Humanoid")
	if humanoid then
		local head = humanoid.Parent:FindFirstChild("HumanoidRootPart")
		head.Anchored = true

		local guy = TweenInfo.new(

			5, -- time
			Enum.EasingStyle.Quad, -- how it transitions
			Enum.EasingDirection.InOut, -- how the values speed up or slow down
			0,
			false,
			0.01
		)
		local coolness = tween:Create(head, guy, {CFrame = head.CFrame + Vector3.new(0, 38, 0)})
		coolness:Play()
		wait(5)
		head.Anchored = false
	end
end)

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