Why is this half way working

Im trying to make the player be teleported . Whilst being teleporting you will see a gui go from left to right . The gui is working but the tp isnt working ;/

script:
repeat

local player  = game.Players.LocalPlayer
local TweenService = game:GetService("TweenService")

local frame = script.Parent
local function onTouch(part)
	local humanoid = part.Parent:FindFirstChild('Humanoid')
	if humanoid then
		frame.Visible = true
		wait(.4)
		frame:TweenPosition(UDim2.new(-0.499, 0,0.499, 0))
		wait()
		
		player.Character.HumanoidRootPart.Cframe = CFrame.new(11, 1.5, 7)
		
		wait(3)
		frame.Visible = false
		
		frame:TweenPosition(UDim2.new(1.55, 0,0.499, 0))


	end
end

game.Workspace.Part.Touched:Connect(onTouch)

until wait(20)

I think you need to use character, not player.
Have a look at the way this script is set up:

https://developer.roblox.com/en-us/articles/How-to-teleport-within-a-Place

1 Like

bet, thanks for helping me :heart: :slight_smile:

You incorrectly spelled cframe it should be CFrame and not Cframe, it’s case sensitive.

2 Likes