#Weird lookat rotating

1 messages · Page 1 of 1 (latest)

cerulean cobalt
#

Why cant I send the script -_-

#

Give me a sec

#
        local lookat = CFrame.lookAt(warriorData.Warrior.PrimaryPart.Position, Vector3.new(targetPosition.Position.X,warriorData.Warrior.PrimaryPart.Position.Y, targetPosition.Position.Z))
        

            if lookVectorTweenData.LastLookat and lookVectorTweenData.LastLookat ~= lookat then
                if lookVectorTweenData.LastTween then
                    lookVectorTweenData.LastTween:Cancel()
                    lookVectorTweenData.LastLookat = nil
                    lookVectorTweenData.LastTween = nil
                end
                
                local tween = tweenService:Create(warriorData.Warrior.PrimaryPart, TweenInfo.new(.05), {CFrame = lookat})
                lookVectorTweenData.LastTween = tween
                lookVectorTweenData.LastLookat = lookat
                tween:Play()
            end
#

This is where the issue comes from

#

it wont let me send the full script for some reason

queen leaf
#

you can use tables

#
local function lookAt()
  local lastTweenData = {} 

  if lastTweenData.LastTween then
      lastTweenData.LastTween:Cancel()
  end
  local tween =     TweenService:Create(warriorPart,     TweenInfo.new(0.5), {CFrame = lookAt})
  tween:Play()
  lastTweenData.LastTween = tween
end