Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. local TweeningSerive = game:GetService("TweenService")
  2. local tweeninfo = TweenInfo.new(1)
  3.  
  4. local item = workspace.Part
  5.  
  6. local goal = {}
  7. goal.Color = Color3.fromRGB(102, 255, 0) -- Green
  8. goal.Size = Vector3.new(16, 4, 8)
  9.  
  10. local goal2 = {}
  11. goal2.Color = Color3.fromRGB(255, 140, 0) -- Orange
  12. goal.Size = Vector3.new(8, 2, 4)
  13.  
  14. local goal3 = {}
  15. goal3.Color = Color3.fromRGB(255, 0, 0) -- Red
  16. goal.Size = Vector3.new(4, 1, 2)
  17.  
  18. local tween1 = TweeningSerive:Create(item, tweeninfo, goal)
  19. local tween2 = TweeningSerive:Create(item, tweeninfo, goal2)
  20. local tween3 = TweeningSerive:Create(item, tweeninfo, goal3)
  21.  
  22. game.Players.PlayerAdded:Connect(function(Player)
  23.     Player.CharacterAdded:Connect(function(Character)
  24.         while wait() do
  25.             local Magnitude = workspace.Part.Position.X - Character.HumanoidRootPart.Position.X
  26.             if Magnitude > -10 then
  27.                 print("The player is near part!")
  28.                 tween1:Play()
  29.             elseif Magnitude > -15 then
  30.                 print("The player is near part but far!")
  31.                 tween2:Play()
  32.             else
  33.                 print("The player is not near part!")
  34.                 tween3:Play()
  35.             end
  36.         end
  37.     end)
  38. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement