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

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

Asked by 4 years ago

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

0
For rotating, you can use CFrame.Angles() and multiply it by a CFrame. DeceptiveCaster 3761 — 4y
0
k Fxding_cam 60 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

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)

0
thanks! Fxding_cam 60 — 4y
0
so i would have to use math.pi Fxding_cam 60 — 4y
0
nvm rad Fxding_cam 60 — 4y
Ad

Answer this question