local player = game.Players.LocalPlayer
local rs = game:GetService("ReplicatedStorage")
local assets = rs:WaitForChild("Assets")
local events = rs:WaitForChild("Events")
local functions = rs:WaitForChild("Functions")
local cookingEvent = events:WaitForChild("StartCooking")
local setcam = functions:WaitForChild("SetCam")
local resetcam = functions:WaitForChild("ResetCam")
local cam = workspace:WaitForChild("Cameras"):WaitForChild("CookingCam")
local lastobj = nil
local weld = nil
function BuildBurg(part)
local part = part:Clone()
weld.Part0 = part
weld = Instance.new("WeldConstraint")
weld.Parent = part
weld.Part1 = part
part.Parent = workspace.Burger
part.CFrame = lastobj.Atc2.WorldCFrame
return part
end
cookingEvent.OnClientEvent:Connect(function(...: any)
setcam:Invoke(cam)
local Food = assets:WaitForChild("Food")
local BBun = Food:WaitForChild("BottomBun"):Clone()
local Patty = Food:WaitForChild("Patty"):Clone()
local TBun = Food:WaitForChild("TopBun"):Clone()
local CookUI = assets:WaitForChild("CookUI"):Clone()
lastobj = BBun
weld = Instance.new("WeldConstraint")
weld.Parent = BBun
weld.Part0 = lastobj
BBun.Parent = workspace.Burger
BBun.CFrame = cam.FocusPoint.CFrame
CookUI.Parent = player.PlayerGui
local PattyButton = CookUI.PattyButton
local FinishButton = CookUI.FinishButton
local TomatoButton = CookUI.TomatoButton
PattyButton.MouseButton1Click:Connect(function()
print(1)
lastobj = BuildBurg(Patty)
end)
end)
so far my code is very buggy, im trying to get it to weld the current part to part0, the one above it to part1