Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function handle()
- game.ReplicatedStorage.DataEvent:FireServer({Type = 'TakeIceCreamCup'})
- wait(.1)
- local plr = game:GetService'Players'.LocalPlayer.Name
- -- Finish Order
- local flavours = {'Vanilla', 'Chocolate', 'Strawberry'}
- local extra = {'Sprinkles', 'Nuts', 'Caramel'}
- local stuff
- local event = game.ReplicatedStorage.DataEvent
- local send_valid = function()
- for k,v in next, workspace.BensIceCream.CustomerTargets:GetChildren()do
- if v.Occupied.Value ~= nil then
- return v
- end
- end
- end
- for s,j in next, workspace.SpawnedCharacters:GetChildren() do
- if j.Name:find('BensIceCream') then
- local char = j
- local p = send_valid()
- if p.Occupied.Value:FindFirstChild('Order') then
- stuff = {}
- for _,x in next, p.Occupied.Value.Order:GetChildren()do
- table.insert(stuff, x.Value)
- end
- end
- end
- end
- local ball = function()
- if workspace[plr]:FindFirstChild('Ice Cream Cup'):WaitForChild'Ball1'.Transparency == 1 then
- return workspace[plr]:FindFirstChild('Ice Cream Cup').Ball1
- elseif workspace[plr]:FindFirstChild('Ice Cream Cup'):WaitForChild'Ball2'.Transparency == 1 then
- return workspace[plr]:FindFirstChild('Ice Cream Cup').Ball2
- end
- end
- table.foreach(flavours, function(s,l)
- for k,v in next, stuff do
- if l:lower() == v:lower() then
- local new = ball()
- event:FireServer({
- Type = "AddIceCreamScoop",
- Taste = v,
- Ball = new,
- })
- new.Transparency = 0
- end
- end
- end)
- table.foreach(extra, function(s,l)
- for k,v in next, stuff do
- if l:lower() == v:lower() then
- event:FireServer({
- Type = "AddIceCreamTopping",
- Taste = l
- })
- end
- end
- end)
- wait()
- for k,v in next, workspace.BensIceCream.CustomerTargets:GetChildren()do
- if v.Occupied.Value ~= nil then
- game.ReplicatedStorage.DataEvent:FireServer({Type = 'FinishOrder', Workstation = v})
- end
- end
- end
- for k,v in next, workspace.BensIceCream.CustomerTargets:GetChildren()do
- v.Occupied:GetPropertyChangedSignal('Value'):Connect(function()
- handle()
- end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement