Keeping model rotation with weld

Hello developers! How can i keep model rotation still when it is welded? I need it to look forward.

Code weld:

local cf0 = CFrame.new(0,-model.PrimaryPart.Size.Y/2,0) * CFrame.Angles(math.rad(90),0,math.rad(180))
weld.C0 = cf0

I tried to use Inverse() but i don’t know how to use it really so it just made model go up player hand

local cf0 = CFrame.new(0,-model.PrimaryPart.Size.Y/2,0) * CFrame.Angles(math.rad(90),0,math.rad(180))
--local cf0 = model.PrimaryPart.CFrame:Inverse()
--local cf1 = char.RightHand.CFrame:Inverse()
weld.C0 = cf0
--weld.C1 = cf1

Do the weld manualy using this plugin: https://www.roblox.com/library/148570182/Weld

It is easier, faster, no need to script and it keep object position and orientation.
Place your mesh where you want it to be, then select the mesh and the part on which you want to weld the mesh at (ctrl + click to select both), go to the plugin tab and click on “Weld All”

This isn’t solution. Camera has scripts that player can take it and put it back.

All objects you insert and remove from the character should be a tool or an accessory, dirrectly welding a mesh to a character body part using a script is useless.

Accessories and tools exist specially for this case, it is easier as all you have to do is to clone or delete the accessory or tool.


Here is the video of how the camera works. Don’t mind the stutters, it is old video.

Then you can do 2 accessories, one which is on your neck and the other on your hand, and switch them when equiping it.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AccessoryFolder = ReplicatedStorage:WaitForChild("Accessories")

local NeckCamera = AccessoryFolder and AccessoryFolder:WaitForChild("NeckCamera")
local HandCamera = AccessoryFolder and AccessoryFolder:WaitForChild("HandCamera ")

local function SwitchCamera(State, Character)
	-- true = equip on hands / false = equip on neck
	
	local CurrentCamera = nil
	local NewCamera = nil
	
	if State == true then
		CurrentCamera = Character:FindFirstChild("NeckCamera")
		NewCamera = HandCamera and HandCamera:Clone()
	elseif State == false then
		CurrentCamera = Character:FindFirstChild("HandCamera")
		NewCamera = NeckCamera and NeckCamera:Clone()
	end
	
	NewCamera.Parent = Character
	if CurrentCamera then
		CurrentCamera:Destroy()
	end
end

SwitchCamera(true, Player.Character)

It could work but animation is still important, it would look bad without that. If there any other ways please include it.

I changed weld rotation to this:
CFrame.new(0,0,-char.UpperTorso.Size.Z) * CFrame.Angles(0,math.rad(180),0)

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