Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Services
- local players = game:GetService("Players")
- local uis = game:GetService("UserInputService")
- local repStor = game:GetService("ReplicatedStorage")
- local run = game:GetService("RunService")
- --Vars
- local plr = players.LocalPlayer
- local char = plr.Character or plr.CharacterAdded:Wait()
- local mouse = plr:GetMouse()
- local cRF = repStor:FindFirstChildOfClass("RemoteFunction")
- local cRE = repStor:FindFirstChildOfClass("RemoteEvent")
- local db = false
- uis.InputEnded:Connect(function(key,gpe)
- if gpe then return end
- if key.UserInputType == Enum.UserInputType.MouseButton1 then
- --if not char and not char:FindFirstChild("Humanoid") then return end
- --char.Humanoid:MoveTo(mouse.Hit.p)
- end
- end)
- local doors,openDoors = cRF:InvokeServer("Doors"),{}
- run.RenderStepped:Connect(function()
- for _,v in next, doors do
- if plr:DistanceFromCharacter(v.ProximityDetector.Position) > 10 or char.Humanoid.Sit then
- openDoors[v] = nil
- cRE:FireServer("HingeDoor",v)
- v.DoorHinge.TargetAngle = v.DoorHinge.UpperAngle
- else
- openDoors[v] = true
- cRE:FireServer("HingeDoor",v)
- v.DoorHinge.TargetAngle = v.DoorHinge.LowerAngle
- end
- end
- end)
- local function lerp(part,target)
- if not part or not target or part.Lerping.Value then return end
- part.Lerping.Value = true
- local oldCF = part.CFrame
- for i = 0,1,.1 do
- part.CFrame = oldCF:lerp(target,i)
- run.RenderStepped:Wait()
- end
- part.Lerping.Value = false
- end
- workspace.Chef.Touched:Connect(function(hit)
- if db then return end
- db = true
- local char = hit:FindFirstAncestorOfClass("Model")
- local hum = char and char:FindFirstChild("Humanoid")
- local plr = char and hum and hum.Health > 0 and players:GetPlayerFromCharacter(char)
- if not plr then return end
- local pizza = true
- local cam = workspace.CurrentCamera
- local targetCam = workspace.CameraChef
- local rad1 = math.rad(1)
- cam.CFrame = targetCam.CFrame
- cam.CameraType = Enum.CameraType.Scriptable
- local lastPos = mouse.Hit.p.Z
- coroutine.resume(coroutine.create(function()
- local selection
- run.RenderStepped:Connect(function()
- local diff = (mouse.Hit.p.X - lastPos)/20
- targetCam.CFrame = CFrame.new(-74.6,33,math.clamp(lastPos + diff/5,-15.925,-.525))*CFrame.Angles(0,rad1*-90,0)
- cam.CFrame = cam.CFrame:lerp(targetCam.CFrame,.5)
- local pos = math.clamp(mouse.Hit.p.X,-14.35,1.4)
- workspace.TV:SetPrimaryPartCFrame(CFrame.new(-64.741,33.6,cam.CFrame.p.Z)*CFrame.Angels(0,rad1*90,0))
- lastPos = lastPos + diff/5
- local topping = mouse.Target
- if not topping and not topping:IsDescendantOf(workspace.Toppings) then return end
- if topping ~= selection then
- if selection then
- lerp(selection,selection.CFrame*CFrame.new(0,-.2,0))
- end
- wait()
- selection = topping
- lerp(selection,selection.CFrame*CFrame.new(0,.2,0))
- end
- if selection then
- lerp(selection,selection.CFrame*CFrame.new(0,-.2,0))
- selection = nil
- end
- end)
- end))
- repStor.Dough:Clone().Parent = workspace
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement