Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i position this model with cframe?

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
0
Answered by
Lucke0051 165
5 years ago

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.

0
ok this worked! Fxding_cam 60 — 5y
0
but how to i adjust it? like how do i rotate it Fxding_cam 60 — 5y
0
to rotate you would have to change the orientation maybe? Lucke0051 165 — 5y
0
through the script or game Fxding_cam 60 — 5y
View all comments (2 more)
0
script Lucke0051 165 — 5y
0
how would i do that? Fxding_cam 60 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago
Edited 5 years ago

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.

0
this isn’t a tool Fxding_cam 60 — 5y

Answer this question