CFrame Tweening Not Working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to tween a parts CFrame but it isn’t working the way I am expecting it to.

  2. What is the issue? Include screenshots / videos if possible!
    Hello, I just made the script below in a ServerScript in the model but I just realised that I only want this to work for the client, not all players. So I moved the entire script no changes to a LocalScript and it isnt working now and I dont know what isnt working, there arent any errors. Here is the script:

--// SETTINGS \\--
local TweenSpeed = 3 -- In Seconds
local EasingStyle = "Quad" -- Linear, Sine, Back, Quad, Quart, Quint, Bounce, Elastic, Exponential, Circular, Cubic - For more info go to: https://developer.roblox.com/en-us/api-reference/enum/EasingStyle
local DelayTime = 0 -- In Seconds

-- Misc Values --
local Opened = false

local Door1OriginalPos = script.Parent:WaitForChild("Door1").CFrame
local Door2OriginalPos = script.Parent:WaitForChild("Door2").CFrame


--// Services \\--
local TweenService = game:GetService("TweenService")

--// Parts \\--
local Door1 = script.Parent:WaitForChild("Door1")
local Door2 = script.Parent:WaitForChild("Door2")
local Opener = script.Parent:WaitForChild("Opener")

--// Positions \\--
local Door1Open = {CFrame = CFrame.new(Door1.Position.X - Door1.Size.X, Door1.Position.Y, Door1.Position.Z)}
local Door2Open = {CFrame = CFrame.new(Door2.Position.X + Door2.Size.X, Door1.Position.Y, Door1.Position.Z)}
local Door1Close = {CFrame = Door1OriginalPos}
local Door2Close = {CFrame = Door2OriginalPos}

--// Tweens \\--
local TweenInformation = TweenInfo.new(TweenSpeed, Enum.EasingStyle[EasingStyle], Enum.EasingDirection.Out, 0, false, DelayTime)

local Tween1Open = TweenService:Create(Door1, TweenInformation, Door1Open) 
local Tween1Close = TweenService:Create(Door1, TweenInformation, Door1Close)
local Tween2Open = TweenService:Create(Door2, TweenInformation, Door2Open)
local Tween2Close = TweenService:Create(Door2, TweenInformation, Door2Close)

local function OpenDoors()

	Opened = true
	Tween1Open:Play()
	Tween2Open:Play()

end

local function CloseDoors()

	Opened = false
	Tween1Close:Play()
	Tween2Close:Play()

end

local function OpenerTriggered()

	if Opened == false then
		OpenDoors()
	else
		CloseDoors()
	end

end

Opener.ProximityPrompt.Triggered:Connect(OpenerTriggered)
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I searched it up on Google, nothing that helped unfortunately. Any help is appreciated thanks! :grin:

Did you just change the script to a LocalScript? For a LocalScript to run, it needs to either be somewhere inside of the player or the player’s character. You’ll also have to change the door variables to the new path as the script will no longer be in the same location.

Thanks, I just used the tag service and got the parts from there, and put the script itself inside of the StarterPlayerScripts. Thank you very much! :grinning: