Tweenservice dont work

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

  1. What do you want to achieve? a lever

  2. What is the issue? tween doesnt work

  3. What solutions have you tried so far? none

script:

 script.Parent.Button.ClickDetector.MouseClick:Connect(function()
	local tweenservice = game:GetService("TweenService")
	local tween = tweenservice:Create(script.Parent.Lever, TweenInfo.new(2), {CFrame = script.Parent.LeverMove.CFrame})
	tween:Play()
end)

Questions:

  • Are you sure that you are clicking the click detector?
  • Is the CFrame of LeverMove the same as the Lever?

yes, im clicking the detector and the cframe isnt the same.

Try this:

script.Parent.Button.ClickDetector.MouseClick:Connect(function()
	local tweenservice = game:GetService("TweenService")
	local Info = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
	local tween = tweenservice:Create(script.Parent.Lever, Info, {CFrame = script.Parent.LeverMove.CFrame})
	tween:Play()
end)

Where is the script located and is it a local script or a server script?

the script is a serverscript is that wrong?

Still doesnt work, does it need to be a local script and does it need to be unanchored?

do local put inside StarterPlayerScripts

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)

Try this:

script.Parent.Button.ClickDetector.MouseClick:Connect(function(Player)
	local tweenservice = game:GetService("TweenService")
	local tween = tweenservice:Create(script.Parent.Lever, TweenInfo.new(2), {CFrame = script.Parent.LeverMove.CFrame})
	tween:Play()
end)

didnt work… :frowning: 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})

ClickDetector.MouseClick:Connect(function()
LeverTween:Play()
end)``

I’m pretty sure you have to increment the CFrame.

{CFrame = script.Parent.LeverMove.CFrame * CFrame.new(0,10,0}

What is shown above is just an example, so change if needed

 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)

Dunno if it work

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.

Good luck.