Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I make this changing position smoothly?

Asked by 2 years ago
Edited 2 years ago

Hello guys I have a problem with this script. I want to make this smoothly.

local Part = script.Parent.Parent.Handle


script.Parent.Touched:Connect(function(hit)
            Part.Position = Part.Parent.CardDown.Position
            wait(2)
            Part.Position = Part.Parent.CardUp.Position
end)

1 answer

Log in to vote
1
Answered by
Puppynniko 1059 Moderation Voter
2 years ago

TweenService

local Part = script.Parent.Parent.Handle
local TS = game:GetService("TweenService")

script.Parent.Touched:Connect(function(hit)
    TS:Create(Part,TweenInfo.new(.5),{Position = Part.Parent.CardDown.Position}):Play()
    wait(2)
    TS:Create(Part,TweenInfo.new(.5),{Position = Part.Parent.CardUp.Position}):Play()
end)
0
Thank you :D Bartosz_olsztyn 16 — 2y
Ad

Answer this question