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

how do i position this model with cframe?

so i am trying to weld this model on to my characters right hand. but when i spawn all the parts are separted. 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 = 1
		
		local ClonedRH = dark:Clone()
		ClonedRH.Parent = character
		
		ClonedRH.Main.CFrame = character:WaitForChild("RightHand").CFrame
		local Weld = Instance.new("Weld")
		Weld.Part0 = ClonedRH.Main
		Weld.Part1 = character:WaitForChild("RightHand")
		Weld.C0	= CFrame.new() -- i dont know what to put here can someone help me
		Weld.Parent = character:WaitForChild("RightHand")
	end)
end)	

here is what happens https://media.giphy.com/media/kBw3AivfsOVP7deGHk/giphy.gif the rest of the parts are far away from the right hand ignore everything except line 15

2 answers

✓ Accepted answer

In the gif a part is stuck to your right hand, I assume its the "main" part. If this is a model, you can set the primaryPart of it to the main, then do:

ClonedRH:SetPrimaryPartCFrame(character:WaitForChild("RightHand").CFrame)

This will move the whole model to the hand. I assume all parts are already welded together in the model, if not you could do a for loop to weld each part with the main part.

6 comments

0

ok this worked!

0

but how to i adjust it? like how do i rotate it

0

to rotate you would have to change the orientation maybe?

0

through the script or game

0

script

0

how would i do that?

I’m going just going assume this is a tool. You have to weld the model / tool together or it will fall apart like that. I’d recommend welding it together outside of a script, but you could do it either way. A good way to weld everything together prior would be to use the moon animator plugin, at least that’s what I liked to use.

Anyways, hoped this helped, let me know if it didn’t.

1 comment

0

this isn’t a tool

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