How can i weld burger?

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

Prob use more cheese…

Umm, do you have any errors?

What is buggy?

Does it work at all?

2 Likes

well you tried setting the part0 before the weld was even created, you also need to set the position before you parent the weld, otherwise it’ll just go back

Adding to this you are also trying to weld the same part to itself same for both welds

no errors, the welds just wont weld properly.
also the first part has 2 welds

i decided to not use welds since i changed my mind on how i wanted this to work.
dont need help anymore. thank you all still

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.