Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Best way to use an 'offset' for setting weld C0s?

Asked by 6 years ago

Right now I have a gun that always looks at your cursor.

Local:

local serverarms = game.Players.LocalPlayer.Character.Arms
game.ReplicatedStorage.Events.MoveArms:FireServer(serverarms,game.Players.LocalPlayer:GetMouse().Hit)

Server:

local absoluteCFrame = CFrame.new(plr.Character.Head.Position, pos.p)
local relativeCFrame = plr.Character.Head.CFrame:toObjectSpace(absoluteCFrame)
model.HeadBaseAnchor.Weld.C0 = relativeCFrame 

Pretty much the code above will automatically move the arms weld (it is welded to the Head) to the cursor. The problem is, however, that the arms can sometimes (when your mouse is looking up or down) 'dismantle' from your torso. Pretty much the arms, from that distance, move away from the torso, though still is welded to the head.

This is what it looks like:

https://i.imgur.com/3hcudjj.png

I've tried using lookvectors to change the offset, but I couldn't figure out how it would automatically offset to be in the correct spot. Does anybody know how I can fix this? Thanks!

0
Oh yeah, if you wondering, the code that I used for the lookvector is this: absoluteCFrame = absoluteCFrame + (model.HeadBaseAnchor.CFrame.lookVector) OsterDog 14 — 6y
0
Bump. Does anybody know this or have I gave too little detail? OsterDog 14 — 6y
0
Does anybody know?? This is becoming a huge problem! OsterDog 14 — 6y
0
Hello, i know its been 3 months, did you get it working? If not then i can try, but no guarantees itll work popgoesme700 113 — 6y

Answer this question