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

Part cloning not next to the player it clones in the player instead?

Asked by
hokyboy 270 Moderation Voter
3 years ago
function ActivateGrimore(Player)
    warn("Server Side Activated")
    local Char = Player.Character
    local Hurmp = Char.HumanoidRootPart

    local newgm = script.Open:Clone()
    newgm.Parent = Char
    newgm.CFrame = Hurmp.CFrame * CFrame.new(0,0,2)

    wait(.1)

    local NewWeld = Instance.new("Weld")
    NewWeld.Parent = Hurmp
    NewWeld.Part0 = Hurmp
    NewWeld.Part1 = newgm

end

So instead of it going infront of the player it just stays in the middle does is this caused by the weld?

1 answer

Log in to vote
1
Answered by 3 years ago

Yes it is caused by the weld. Here you would want to set the C0 (or C1) property of the weld for an offset.

ex. NewWeld.C0 = CFrame.new(0, 0, -2)

this would make the part be 2 studs in front of your humanoidrootpart (if the humanoidrootpart is the weld's Part0)

0
Hey quick question how can i change the rotation for the cloned part cause when i use newgm.orientation it does not work? hokyboy 270 — 3y
0
Multiply the CFrame by CFrame.Angles(), for example: NewWeld.C0 = CFrame.new(0, 0, -2) * CFrame.Angles(math.rad(90), 0, 0) Brandon1881 721 — 3y
Ad

Answer this question