How can I fix my sword orientation issue?

Hello, I have quite the… unique way of switching sword skins. The default sword is oriented correctly but when the mesh is changed it breaks the orientation.

		if player.Inventory.EquipSword.Value == "RedSword" then
			player.Backpack.Sword.Handle.Mesh.MeshId = "http://www.roblox.com/asset/?id=409664704"
			player.Backpack.Sword.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=409665021"
			player.Backpack.Sword.Handle.Mesh.Scale = Vector3.new(2.5, 2.5, 2.5)
		end
		if player.Inventory.EquipSword.Value == "BlueSword" then
			player.Backpack.Sword.Handle.Mesh.MeshId = "http://www.roblox.com/asset/?id=365565135"
			player.Backpack.Sword.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=365565061"
			player.Backpack.Sword.Handle.Mesh.Scale = Vector3.new(2, 2, 2)
		end
		if player.Inventory.EquipSword.Value == "DarkSword" then
			player.Backpack.Sword.Handle.Mesh.MeshId = "http://www.roblox.com/asset/?id=94840342"
			player.Backpack.Sword.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=250727362"
			player.Backpack.Sword.Handle.Mesh.Scale =  Vector3.new(.75, .75, .75)
		end
		if player.Inventory.EquipSword.Value == "OmegaSword" then
			player.Backpack.Sword.Handle.Mesh.MeshId = "http://www.roblox.com/asset/?id=283709615"
			player.Backpack.Sword.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=283709681"
			player.Backpack.Sword.Handle.Mesh.Scale = Vector3.new(.5, .5, .5)
		end

This seems to work correctly for the mesh, texture, and size but the orientation is off.

1
This is the default sword and the orientation is correct.

2
This is a different sword and the orientation is wrong. Note that the only things that changed are the mesh, texture, and size.

If I need to provide any additional information then please let me know!

2 Likes

You might want to change the ToolGrip as well with the help of clonetrooper’s editor (https://www.roblox.com/library/174577307/Tool-Grip-Editor)

And add the tool grip numbers to the script for every sword mesh!

There is a plugin called tool grip editor by CloneTrooper1019 which is very popular for changing the orientation and positions of a tool grip.

1 Like

Ahaha! This will be embarrassing, I can’t afford that at this point in time. Is there anyway to edit toolgrip manually with a script?

You can always try to mess with the ToolGrip numbers until you find the perfect orientation before putting them in your script. Eh, that’s all I can think of without the plugin.

Hi! Tool grips are hard to understand if you don’t know a lot about CFraming so to bypass all of this, i just make a .5x.5x.5 part and weld it to the swords handle, THEN name the part handle and the player will hold the part handle and it will look exactly like if you got the tool grip perfect! Hope i helped :3

2 Likes

Amazing! I got the hang of this! One (hopefully) final question, how can I set the toolgrip values via script

use tool.Grip = someCFrame to set it
tool.Grip is a local offset from where the hand holds tools
the little grip properties are just the directional vectors from tool.Grip (up, look, and right)

I believe Grip is a property of Tool

I believe tool grip editor is opensourced on CloneTrooper’s github

link - GitHub - Anaminus/roblox-tool-grip-editor: [ARCHIVED] A Roblox plugin that simplifies the modification of a Tool's Grip properties.

its old but might work otherwise you can always set it manually

1 Like

For something like this, my personal recommendation is to create an artificial handle using accessories. Instead of putting the handle in the tool, you would put it in an accessory which would be attached when the tool is equipped or destroyed when it is unequipped. You can then work from here better.

You have two options for how you can change this artificial handle: you can change the mesh and attachment properties so you’re only using one accessory (good on memory), or you can create all the tool handles in a folder and preset everything necessary via Studio (good on ease of access and comfortability).

I wrote a post on attaching assets to players’ hands some time ago, which you can use as a reference. I intend to expand it at some point into a much more detailed resource. It is here:

2 Likes