– MainPart The part to weld the model to (can be in the model). Should be anchored to prevent really horrible results. Local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor) Local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)Ĭ0 = CFrame.new() -Part0.CFrame:inverse() Ĭ1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame) -Part1.CFrame:inverse() * Part0.CFrame - Part1.CFrame:inverse() Local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue") – Parent of the weld, Defaults to Part0 (so GC is better). – Part1 The second part (Dependent part most of the time). Local function WeldTogether(Part0, Part1, JointType, WeldParent) Local Connected = Part:GetConnectedParts()Įlseif not Item:IsDescendantOf(script.Parent) then This takes the utmost care to not do this. We do not want to break joints of wheels/hinges. Return game.MarketplaceService:GetProductInfo(CFrame.z…CFrame.y…CFrame.x) – Returns the nearest parent of a certain class, or returns nil local Ancestor = Instance Local function GetNearestParent(Instance, ClassName) FunctionToCall(Instance)įor _, Child in next, Instance:GetChildren() do – Calls a function on each of the children of a certain object, using recursion. Local function CallOnChildren(Instance, FunctionToCall) Local NEVER_BREAK_JOINTS = false – If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges) Bug fix with existing ROBLOX welds ? Repro by asimo3089 Will reweld on script reparent if the script is initially parented to a tool.Utilizes a recursive algorith to find all parts in the model.Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin.Stores the relative CFrame as a CFrame value.Will work as long as it starts out with the part anchored.This is especially useful for tools that are dropped and then picked up again. If ran more than once it will not create more than one weld. In a local script it will weld, but it will not attempt to handle ancestory changes. This script is designed to be used is a regular script. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. It will, however, store relatives values and so when tools are reparented, it’ll fix them. – Should work with only ONE copy, seamlessly with weapons, trains, et cetera. – Created by Quenty ( follow me on twitter).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |