Advertisement
dogzy

Untitled

Oct 1st, 2022
5,403
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | Source Code | 1 0
  1. local ws = game.Workspace
  2. local player = game.Players.LocalPlayer
  3.  
  4. local cons = {}
  5.  
  6. local TweenService = game:GetService("TweenService")
  7. local tweenInfo = TweenInfo.new(
  8.     0.6, -- Time
  9.     Enum.EasingStyle.Linear, -- EasingStyle
  10.     Enum.EasingDirection.Out, -- EasingDirection
  11.     0, -- RepeatCount (when less than zero the tween will loop indefinitely)
  12.     false, -- Reverses (tween will reverse once reaching it's goal)
  13.     0.1 -- DelayTime
  14. )
  15. local count = 0
  16.  
  17. for i, v in pairs(ws.CandyCorns:GetChildren()) do
  18.     local me = player.Character.HumanoidRootPart
  19.     local candy = v.Position
  20.    
  21.     local tween = TweenService:Create(me, tweenInfo, {CFrame = CFrame.new(candy)})
  22.     tween:Play()
  23.     tween.Completed:Wait()
  24.     tween:Destroy()
  25.     break
  26. end
  27.  
  28. ws.CandyCorns.ChildAdded:Connect(function(child)
  29.     local me = player.Character.HumanoidRootPart
  30.     local candy = child.Position
  31.    
  32.     local tween = TweenService:Create(me, tweenInfo, {CFrame = CFrame.new(candy)})
  33.     tween:Play()
  34.     tween.Completed:Wait()
  35.     tween:Destroy()
  36. end)
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement