Hello,
I have been working on a maze. I have created a template. However, I think it would be really cool if the maze walls moved. Though, I don't know how to move an object, hence why I'm here.
I have been able to rotate an object using the script:
local ts = game:GetService("TweenService") local part = script.Parent local info = TweenInfo.new(20, Enum.EasingStyle.Linear, Enum.EasingDirection.Out,-1) local properties = {CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(180),0)} local tween = ts:Create(script.Parent,info,properties) tween:Play()
However, moving a block, and keeping it there for a random amount of time, then moving it back, is a little to complex to me.
Here is my template maze: https://cdn.discordapp.com/attachments/356675974928007168/522134507227447316/unknown.png
Any suggestions you can make will be appreciated.
Alright first of all. Make a model. Name it for example "PartModel" and inside of that model you will place three parts and call them PartA , PartB, PartC. Place the following script inside of model:
local TweenService = game:GetService("TweenService") while true do local Info = TweenInfo.new(3) local goal = {} goal.CFrame = script.Parent.PartB.CFrame -- First Destination local Tween = TweenService:Create(script.Parent.PartC, Info, goal) -- PartC is the part that moves Tween:Play() wait(5) local Info = TweenInfo.new(3) local goal = {} goal.CFrame = script.Parent.PartA.CFrame -- Second Destination local Tween = TweenService:Create(script.Parent.PartC, Info, goal) Tween:Play() wait(5) end
I recommend you to make CanCollide to false and Transparency to 1 of PartB and PartA. Hope this helps.