Why does tweening the player do this?

  1. What do I want to achieve?

I am Making a trap script, where when the player walks over a part, they get pulled under the floor.

  1. What is the issue?
    When the tween starts, the player randomely get teleported away from the place they were frozen, as you can see in this GIF:

Showcase5

  1. What solutions have I tried so far?
    Yes, I have looked for solutions online but it seems I’m the only person on the internet having this problem. I have tried:

-forcing the player back to their original position (didn’t work),
-welding the player to a part and making that part move, (didn’t work),
-Asking chatgpt, player still got teleported randomly (didn’t work).

Code

local TweenService = game:GetService("TweenService")

local TI = TweenInfo.new(10)

local TouchPart = script.Parent
local GoreSFX1 = TouchPart.Grabbed1
local GoreSFX2 = TouchPart.Grabbed2

local MovingPart = TouchPart.Move

local canTouch = true

TouchPart.Touched:Connect(function(hit)
	if canTouch == true then
		if hit.Parent.Humanoid ~= nil then
			canTouch = false

			local plr = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
			local PlayerGUI = plr.PlayerGui
			local Hum = hit.Parent:FindFirstChild("Humanoid")
			local Root = hit.Parent:FindFirstChild("HumanoidRootPart")
			
			GoreSFX1:Play()
			
			Root.Anchored = true
			
			Hum.PlatformStand = true

			for i, v in pairs(hit.Parent:GetChildren()) do
				if v:IsA("Part") then
					v.CanCollide = false
				end
			end
			
			wait(0.1)

			GoreSFX2:Play()

			wait(4)
			local PullGoal = {}
			PullGoal.CFrame = Root.CFrame * CFrame.new(0,-5,0)
			local PullAnim = TweenService:Create(Root, TI, PullGoal)
			PullAnim:Play()

		end
	end
end)
1 Like