Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

do i have to use cframe to rotate and position this model?

so i am trying to weld this model on to my characters right hand. but when i spawn the model is rotated wrong. here is the script

local rp = game.ReplicatedStorage
local dark = rp:WaitForChild("Right Hand")


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:connect(function(character)
		character:WaitForChild("RightHand").Transparency = 0
		
		local ClonedRH = dark:Clone()
		ClonedRH.Parent = character
		
		ClonedRH:SetPrimaryPartCFrame(character:WaitForChild("RightHand").CFrame)
		local Weld = Instance.new("Weld")
		Weld.Part0 = ClonedRH.Main
		Weld.Part1 = character:WaitForChild("RightHand")
		Weld.C0	= CFrame.new()
		Weld.Parent = character:WaitForChild("RightHand")
	end)
end)	

here is what happens, i dont know how to rotate the model. https://media.giphy.com/media/iGeM4adm6zRlW5P1fg/giphy.gif

2 comments

0

For rotating, you can use CFrame.Angles() and multiply it by a CFrame.

0

k

1 answer

✓ Accepted answer

In order to rotate it, you need to use weld offsets (C0 and C1). In the script shown, just add

Weld.C1 = CFrame.new(--dirrectional offset here--) * CFrame.Angles(x,y,z) 

to rotate the object (note cframe.angles takes radians instead of degrees for rotation)

3 comments

0

thanks!

0

so i would have to use math.pi

0

nvm rad

This discussion is preserved as it was. New answers, comments, and votes are closed.