Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TimeToFillDrink = 1 --In Seconds
- script.Parent.Touch.Touched:connect(function(h)
- if h.Parent.Name == "Soda Cup" then
- script.Parent.blob.Transparency = .3
- h.Parent.Handle.Filling.BrickColor = script.DrinkColor.Value
- h.Parent.Name = script.DrinkName.Value
- -- h.Parent.ice1.Transparency = .3
- -- h.Parent.ice2.Transparency = .3
- local ice = h.Parent.Handle.Filling
- local fill = ice.Mesh
- fill.Offset = Vector3.new(0,-.43,0)
- fill.Scale = Vector3.new(0.9,0,.8)
- coroutine.resume(coroutine.create(function()
- for i=0,TimeToFillDrink,0.01 do
- if h ~= nil then --In case :)
- local offset = -(.43-(.43*(i/TimeToFillDrink)))
- local iceOffset = -(.6-(.6*(i/TimeToFillDrink)))
- 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)
- fill.Offset = Vector3.new(0,offset,0)
- fill.Scale = Vector3.new(0.9,i/TimeToFillDrink,0.8)
- ice.Ice.ice1.Transparency = 1-((i/TimeToFillDrink)*0.8)
- ice.Ice.ice2.Transparency = 1-((i/TimeToFillDrink)*0.8)
- --print(offset)
- wait(0.01)
- end
- end
- h.Parent.CanDrink.Value = true
- end))
- wait(.7)
- script.Parent.blob.Transparency = 1
- end
- end)
- function colors()
- script.Parent.filling.BrickColor = script.DrinkColor.Value
- script.Parent.blob.BrickColor = script.DrinkColor.Value
- end
- colors()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement