registerForEvent("onUpdate", function()

tp = Game.GetTeleportationFacility()
player = Game.GetPlayer()
vPos = player:GetWorldPosition()
vDir = player:GetWorldForward()

-- handling rotation v02
local x = (vDir.x * 100)
local y = (vDir.y * 100)
if x < 50 and y > 50 then
    rot = EulerAngles.new(0,0,0)
elseif x < 0 and y < 50 and y > 0 then
    rot = EulerAngles.new(0,0,90)
elseif x > -50 and y < -50  then
     rot = EulerAngles.new(0,0,180)
elseif x > 50 and y > -50 and y < 0 then
    rot = EulerAngles.new(0,0,270)
end

    local key1 = GetAsyncKeyState(0x55) -- press U
    if key1 ~= space_state then
        space_state = key1
        if space_state then
			local vNewX = vPos.x + (vDir.x * 2.5)
			local vNewY = vPos.y + (vDir.y * 2.5)
			vTp = Vector4.new(vNewX,vNewY,vPos.z,vPos.w)
			tp:Teleport(player, vTp , rot)
		end
	end
--
end)