-
What do I want to achieve?
- I want to make it so that when a Checkpoint in the
Stages
folder inWorkspace
is touched, it plays a clean animation like shown below using tweenService
- I want to make it so that when a Checkpoint in the
-
What is my issue?
- I have created this script, it is in
ServerScriptService
, I tried for so long now to make a clean animation usingTweenService
but I cant seem to actually figure it out. The animation is either not working or really not good looking.
- I have created this script, it is in
-
What solutions have I tried so far?
- I tried pretty much everything; Browsing on the DevForum, contacting people and even ChatGPT**
**This is my CheckpointAnimation
script in ServerScriptService
, does anyone know how I could make this animation look better? Like in the video below?
local TweenService = game:GetService("TweenService")
local Stages = workspace.Stages
local tweenDuration = 3
local scaleAmount = Vector3.new(2, 0, 2)
local duplicateTransparency = 0.5
local partTriggeredMap = {}
function animate(part)
if partTriggeredMap[part] then
return
end
partTriggeredMap[part] = true
local duplicate = Instance.new(part.ClassName)
duplicate.CFrame = part.CFrame
duplicate.Size = part.Size
duplicate.Transparency = 1
duplicate.CanCollide = false
duplicate.Parent = part.Parent
local tweenInfo = TweenInfo.new(tweenDuration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
local sizeTween = TweenService:Create(duplicate, tweenInfo, {Size = part.Size + Vector3.new(2, 0, 2)})
local transparencyTween = TweenService:Create(duplicate, tweenInfo, {Transparency = duplicateTransparency})
sizeTween:Play()
transparencyTween:Play()
local connection1 = sizeTween.Completed:Connect(function()
if transparencyTween.PlaybackState == Enum.PlaybackState.Completed then
duplicate:Destroy()
end
end)
local connection2 = transparencyTween.Completed:Connect(function()
if sizeTween.PlaybackState == Enum.PlaybackState.Completed then
duplicate:Destroy()
end
end)
end
for _, part in ipairs(Stages:GetChildren()) do
if part:IsA("BasePart") then
partTriggeredMap[part] = false
part.Touched:Connect(function()
animate(part)
end)
end
end
Any help is appriciated!!!