Advertisement
script2lu

Soda Machine Script

Jan 19th, 2020
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. local TimeToFillDrink = 1 --In Seconds
  2.  
  3. script.Parent.Touch.Touched:connect(function(h)
  4. if h.Parent.Name == "Soda Cup" then
  5. script.Parent.blob.Transparency = .3
  6. h.Parent.Handle.Filling.BrickColor = script.DrinkColor.Value
  7. h.Parent.Name = script.DrinkName.Value
  8. -- h.Parent.ice1.Transparency = .3
  9. -- h.Parent.ice2.Transparency = .3
  10. local ice = h.Parent.Handle.Filling
  11. local fill = ice.Mesh
  12. fill.Offset = Vector3.new(0,-.43,0)
  13. fill.Scale = Vector3.new(0.9,0,.8)
  14. coroutine.resume(coroutine.create(function()
  15. for i=0,TimeToFillDrink,0.01 do
  16. if h ~= nil then --In case :)
  17. local offset = -(.43-(.43*(i/TimeToFillDrink)))
  18. local iceOffset = -(.6-(.6*(i/TimeToFillDrink)))
  19. ice.Weld.C0 = CFrame.new(0, iceOffset, 0, 0.991828203, 0.0097050434, 0.127212554, -0.0182216093, 0.997656047, 0.0659558997, -0.126274422, -0.0677349046, 0.989680886)
  20. fill.Offset = Vector3.new(0,offset,0)
  21. fill.Scale = Vector3.new(0.9,i/TimeToFillDrink,0.8)
  22. ice.Ice.ice1.Transparency = 1-((i/TimeToFillDrink)*0.8)
  23. ice.Ice.ice2.Transparency = 1-((i/TimeToFillDrink)*0.8)
  24. --print(offset)
  25. wait(0.01)
  26. end
  27. end
  28. h.Parent.CanDrink.Value = true
  29. end))
  30. wait(.7)
  31. script.Parent.blob.Transparency = 1
  32. end
  33. end)
  34.  
  35.  
  36. function colors()
  37. script.Parent.filling.BrickColor = script.DrinkColor.Value
  38. script.Parent.blob.BrickColor = script.DrinkColor.Value
  39. end
  40.  
  41.  
  42. colors()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement