local TweenService = game:GetService("TweenService")
local Lever = LeverLOCATION
local LeverMove = LeverMoveLOCATION
local ClickDetector= CLICKDETECTOR
local Info = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local LeverTween = TweenService:Create(Lever, Info, {CFrame = LeverMove.CFrame})
ClickDetector.MouseClick:Connect(function()
LeverTween:Play()
end)
didnt work… Im copying the map in a script which has the lever in it. ``repeat wait() until game.Workspace:FindFirstChild(“Chapter One”)
local TweenService = game:GetService(“TweenService”)
local Lever = workspace[“Chapter One”].Lever1.Lever
local LeverMove = Lever.Parent.LeverMove
local ClickDetector = Lever.Parent.Button.ClickDetector
local Info = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local LeverTween = TweenService:Create(Lever, Info, {CFrame = LeverMove.CFrame})
script.Parent.Button.ClickDetector.MouseClick:Connect(function()
local tweenservice = game:GetService("TweenService")
local New = CFrame.new(script.Parent.LeverMove.CFrame)
local tween = tweenservice:Create(script.Parent.Lever, TweenInfo.new(2), New)
tween:Play()
end)
You code looks fine, put a print in there to make sure it is running. Tweens should work on both Local and Server scripts. The part should be anchored for the Tween to run so it does not fall out of the Tween.
It’s a bit hard to tell from the question what “not working” is but for the purposes of this post I’ll assume nothing is happening when you click the click detector.
To start with, put a print statement inside the click detector’s connected function. This will make sure the click detector is actually working instead of first assuming that the issue is with the tween.
If the print works, then the issue might be with your CFrames. Make sure the CFrames are in two seperate locations/rotations and that they are being tweened properly using one of the tween examples others have posted here.
Hopefully this helps but if not, I’ll see what else I can do.