GIEGO04
(GEGO)
August 21, 2022, 9:16am
#1
I’ve been trying to fix this problem for a whole day, I’m super stressed I tried to do a thousand things but none of them worked
The problem is that I want to weld a Model to my Tool, but when welding it the correct position does not appear
Code:
Remotes.EquipAttachment.OnServerEvent:Connect(function(player, Tool, SightModel)
if SightModel.Type.Value == "Sight" then
local NewAtt = SightModel:Clone()
NewAtt.Parent = Tool.Attachments.Sights
NewAtt.Main.CFrame = Tool.BodyAttach.SightPos.WorldCFrame
local Weld = Instance.new("WeldConstraint", NewAtt)
Weld.Name = "AttachmentWeld"
Weld.Part0 = NewAtt.Main
Weld.Part1 = Tool.BodyAttach
end
end)
Tool.BodyAttach.SightPos.WorldCFrame is a Attachement
SightModel
Tool.BodyAttach
I feel like I’m doing something wrong but I don’t know whaaaaaaaaaaat
(Anything helps! )
GIEGO04
(GEGO)
August 21, 2022, 9:50am
#2
Btw the script is in the server.
FerbZides
(FerbZides)
August 21, 2022, 10:07am
#3
Where would sightpos
be located? WorldCFrame is the cframe of an object but free of it’s parent.
GIEGO04
(GEGO)
August 21, 2022, 10:08am
#4
GIEGO04:
Tool.BodyAttach
There is SightPos Is a Attachment
FerbZides
(FerbZides)
August 21, 2022, 10:14am
#5
Can you click it and see where it is located?
FerbZides
(FerbZides)
August 21, 2022, 10:17am
#7
Where would you expect it to be located?
FerbZides
(FerbZides)
August 21, 2022, 10:28am
#9
Try motor6d instead? If it that does not work then try changing WorldCFrame to CFrame.
GIEGO04
(GEGO)
August 21, 2022, 10:39am
#10
I try to use a Motor6D, but what it does is put it in the position of the bodyAttach. I change the WorldCFrame to CFrame, I also tried it with the Weld from before
Neither of them worked…
FerbZides
(FerbZides)
August 21, 2022, 10:42am
#11
Instead of setting the part’s CFrame to something, can you do this?:
-- I'm assuming you already have a primary part setup, of which, is the part named "Main".
Model:SetPrimaryPartCFrame(ourCFrame)
1 Like
GIEGO04
(GEGO)
August 21, 2022, 10:47am
#12
The same problem happens
Like this right?
local NewAtt = Attachment:Clone()
NewAtt.Parent = Tool.Attachments.Sights
NewAtt:SetPrimaryPartCFrame(Tool.BodyAttach.SightPos.WorldCFrame)
--NewAtt.Main.CFrame = Tool.BodyAttach.SightPos.WorldCFrame
local Weld = Instance.new("WeldConstraint", NewAtt)
Weld.Name = "AttachmentWeld"
Weld.Part0 = NewAtt.Main
Weld.Part1 = Tool.BodyAttach
And yes my sight have a PrimaryPart set, which is Main
Tey using RigidConstraints much easier than welding.
The issue seems to be weld constraints server to client issue which I have seen before.
GIEGO04
(GEGO)
August 21, 2022, 11:06am
#14
I have never used RigidConstraint but what I did was add an Attachment to “Main” and put it as Attachment1 and the BodyAttach as Attachment0 but when equipping the gun it seems that it did not weld and it falls off the map or I think so because after a few seconds disappears
Remember to parent,
Otherwise follow something similar to below:
Weld method with attachments:
I swear I tried that but I actually got that to work this time around.
so this is actually the true solution:
local RightGrip = Instance.new("Weld")
RightGrip.Name = "Right Grip"
RightGrip.Parent = CharacterClone:FindFirstChild("Right Arm")
RightGrip.Part0 = CharacterClone:FindFirstChild("Right Arm")
RightGrip.Part1 = ToolClone.Handle
RightGrip.C1 = ToolClone.Grip * CFrame.Angles(math.rad(90),0,0)
RightGrip.C0 = CharacterClone:FindFirstChild("Right Arm").RightGripAttachment.CFrame…
Rigid constraint method:
I decided to use the Rigid Constraint you were talking about and that worked very well
for anyone curious this is what I did:
local RigidConstraint = Instance.new("RigidConstraint")
RigidConstraint.Parent = CharacterClone:FindFirstChild("Right Arm")
RigidConstraint.Attachment0 = CharacterClone:FindFirstChild("Right Arm").RightGripAttachment
local Attachment = Instance.new("Attachment")
Attachment.CFrame = ToolClone.Grip * CFrame.Angles(math.rad(90),0,0) --This offset is applied by default f…
GIEGO04
(GEGO)
August 21, 2022, 5:00pm
#16
I fix it, but I had to change things on my weapon
Change the Attachment(“SightPos”) to a part, and change the WeldConstraint to a Weld.
If anyone has the solution for some reason, I’ll change it and mark it as a solution