Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is wrong with this script?[Not answered]

Am I missing something?

local function weldBetween (a,b)
	local weld = Instace.new ("ManualWeld")
	weld.Main = a----Part 1
	weld.Part1 = b----Part 2
	weld.C0 = Cframe.new()---Determines how offset the first part should be 
	weld.C1 = b.Cframe:Inverse() *a.Cframe ---* moves do the cframe
	weld.Parent = a
	return weld;
	
	
end

weldBetween (game.Workspace.Drone.Main, game.Workspace.Drone.Part1

1 comment

0

Please reformat your code.

1 answer

Try this:

local function weldBetween(a,b)
	local weld = Instance.new("Weld")
	weld.Part0 = a
	weld.Part1 = b
	weld.C0 = CFrame.new()
	weld.C1 = b.CFrame:inverse()*a.CFrame
	weld.Parent = a
	return weld;
end

weldBetween()--[[put where you want the weld to be between in these ()
example: weldBetween(game.Workspace.weldExample1, game.Workspace.weldExample2)
they both are parts btw --]]

4 comments

0

ITSolarWinds, i can't comment on you question for some reason but yes try that but remove line 13

0

in you 2nd questiong after me sorry

0

Ok thanks!

0

It says there is an error in the output 12:50:59.130 - Stack Begin 12:50:59.131 - Script 'Workspace.Weld', Line 2 - local weldBetween 12:50:59.131 - Script 'Workspace.Weld', Line 12 12:50:59.132 - Stack End

This discussion is preserved as it was. New answers, comments, and votes are closed.