So I want to animate a brick moving up and down and simultaneously rotating
So the issue is it only rotates, doesn’t move up and down even though I have created a tween for them and playing them
I have tried looking but I can’t find anything, I’m thinking of using a coroutine but I’m not sure
heres my module script
local module = {}
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quart, Enum.EasingDirection.In)
local y = -0.5
function module:newMovement(part)
local newPos = CFrame.new(0, y, 0)
local newRot = CFrame.Angles(0, 0, 0)
local tween = tweenService:Create(part, tweenInfo, {CFrame = newPos, CFrame= newRot})
tween:Play()
tween.Completed:Wait()
end
function module:endMovement(part)
local endPos = CFrame.new(0, math.abs(y), 0 )
local endRot = CFrame.Angles(0, 360, 0 )
local tween = tweenService:Create(part, tweenInfo, {CFrame = endPos, CFrame = endRot})
tween:Play()
tween.Completed:Wait()
end
return module
Server Script
-- Services --
local rs = game:GetService("ReplicatedStorage")
-- Variables --
local Modules = rs:WaitForChild("Modules")
--local remotes = rs:WaitForChild("Remotes")
local BoxAnimation = Modules.BoxAnimation
local Animations = require(BoxAnimation)
local part = script.Parent
local isTouched = false
local canBreak
while true do
wait()
Animations:newMovement(script.Parent)
Animations:endMovement(script.Parent)
end