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

Using toObjectSpace on tool grip?

Asked by
cabbler 1942 Moderation Voter
7 years ago

Say there a tool with a handle. And there is also a part in the workspace. I want the tool's grip to be the same as the workspace part CFrame, so that the handle is inside the part when equipped. This doesn't seem to work:

tool.Grip = game.Workspace.Player1.Torso.CFrame:toObjectSpace(game.Workspace.Part.CFrame) or tool.Grip = game.Workspace.Part.CFrame:toObjectSpace( game.Workspace.Player1.Torso.CFrame)

1 answer

Log in to vote
0
Answered by 7 years ago

At this point you need to ask yourself if this is really the best option.

In this situation, it would be far simpler to hide the Tool's model, create a clone from ReplicatedStorage and move that to the target location, then remove it when the tool is unequipped. Your way is not only more complex but can have other negative effects, as it will move your character's center of mass.

And by the way, the tool is gripped with your Right Arm, not your Torso.

0
I didn't ask for alternatives. Obviously my second choice is to weld the target, but it would be simpler to use the grip which is an auto weld. cabbler 1942 — 7y
0
Well in that case then you should need to game.Workspace.Player1.Torso to game.Workspace.Player1["Right Arm"]. Also, if you weld the handle to a part whilst a character holds it, then either the part will be attached to the player or the player will be stuck on the part. SwardGames 325 — 7y
0
I tried using the right arm, it doesn't adjust for the character's rotation or height. Same problem. cabbler 1942 — 7y
Ad

Answer this question