Funky Weapon Rotation

  1. What do you want to achieve?
    I would like the sword to be rotated properly, and for the solution to work for all weapons.

  2. What is the issue?
    The sword juts out to the right of the character, and needs to be rotate 90 degrees to the left.

  3. What solutions have you tried so far?

  • weld.C1 (problem with this is that i want this to work for all weapons, some rotate fine)
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local remotes = ReplicatedStorage:WaitForChild("Remotes")
local inputEvent = remotes:WaitForChild("InputEvent")

local modules = ReplicatedStorage:WaitForChild("Modules")
local valuesModule = require(modules:WaitForChild("Values"))

local models = ReplicatedStorage:WaitForChild("Models")

inputEvent.OnServerEvent:Connect(function(player, args)
	
	local blockInput = valuesModule.findValue(player, "blockInput")
	local attackInput = valuesModule.findValue(player, "attackInput")
	local equipInput = valuesModule.findValue(player, "equipInput")
	
	local character = player.Character
	local humanoid = character:FindFirstChild("Humanoid")
	local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
	local rightArm = character:FindFirstChild("Right Arm")

	if valuesModule.findValue(player, "equipped") then
		
		if args.input == blockInput then
			
			print("block")
			
		elseif args.input == attackInput then
			
			print("attack")
		
		elseif args.input == equipInput then
			
			valuesModule.changeValue(player, "equipped", false)
			
			
		end
		
	else
		
		if args.input == equipInput then
			
			valuesModule.changeValue(player, "equipped", true)
			
			local weaponName = valuesModule.findValue(player, "weapon")
			local weapon = models:FindFirstChild(weaponName)
			
			local weaponClone = weapon:Clone()
			local primaryPart = weaponClone.PrimaryPart

			weaponClone.Parent = rightArm
			
			local weld = Instance.new("Motor6D", rightArm)
			weld.Part0 = rightArm
			weld.Part1 = primaryPart


		end
	end
	
end) 

Most relevant code is this here:

there should be a property under Tool and you can change the Proivt in there

Go to the motor6D weld that you use to weld the tool to the player, then just change the orientation of it on the Y to be 90 degrees. Try changing it on the C0 first, then C1 if that doesn’t work. It would be like this

motor6D.C0 = motor6D.C0 * CFrame.Angles(0, math.rad(90), 0)

You can also change the pivot under the tool, under Grip, then Orientation.

it is not a tool, im making it completely bare bones

Unfortunately this is not an option since some weapons are fine as is.

nvm gang figured it out, just hadda rotate the handle

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.