Movable wall onClick: Help!

I want to achieve a movable wall on click. If you click on it it’ll move to another part such as ‘EndPart’ and if you click on it when it’s at the ‘EndPart’ it’ll go back to the start part.

The issue: Everytime I’ve tried this trough tweening the part or cframing it it shows errors I can’t fix somehow. Can’t get an example of my script as I deleted it. I need this for my showcase.

I’ve tried tweening it or cframing it and changing a part that moves when you’re close (like the Jailbreak fence) to a Clickable part.

This example worked for me with two parts named a and b in workspace. Both were anchored.

local a, b, TS = workspace.a, workspace.b, game:GetService(“TweenService”)

info =, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)


animation = TS:Create(a, info, {[‘CFrame’] = b.CFrame})

You can also change the second part to change the end CFrame, e.g. changing b to a part named c in workspace, then play the anim

Here’s a more refined version. When the player clicks on the part, simply call tweenCF and provide the end CFrame:

local wall = workspace.a
local TS = game:GetService("TweenService")

info =, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)

local function tweenCF(part, endCF)
	animation = TS:Create(part, info, {['CFrame'] = endCF})
	return animation
-- Simple loop to demonstrate reusable function
while wait() do
	tweenCF(wall, workspace.b.CFrame):Play()
	tweenCF(wall, workspace.c.CFrame):Play()

Also, make sure you perform a wait() preferably as long as the anim after you play it, or weird things may happen. I forgot this once and it made my animation a lot slower, because TweenServiceAnim:Play() will not yeild