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

SetPrimaryPartCFrame is not a valid member of Part?

while true do
	print("bruhmoment")
	wait(1)
	local original = game.Lighting.light
	local copy = original:Clone()
	
	copy.Parent = game.Workspace
	copy:SetPrimaryPartCFrame(game.Workspace.regenspot.Position)
end

Hello. I am pretty sure I am not doing anything wrong because even when I read the wiki for :Clone(), (https://developer.roblox.com/en-us/api-reference/function/Instance/Clone), I have found :SetPrimaryPartCFrame. I have used this in my code but it says its not a valied member of part??

2 comments

0

This might not be related to your current issue, but make sure to pass a CFrame when using SetPrimaryPartCFrame instead of a Vector3

0

The error is self-explanatory. You're attempting to call a Model function from a BasePart. For BaseParts you can use their CFrame property directly.

3 answers

✓ Accepted answer
-- Vector 3 is defining a position by using X Y Z values
-- CFrame is defining a position AND rotation of one part. If you set a CFrame of one part to another then the part you set the CFrame to will position and rotate itself to the one you set it to's front face
while true do
    print("bruhmoment")
    wait(1)
    local original = game.Lighting.light
    local copy = original:Clone()

    copy.Parent = game.Workspace
    copy.CFrame = game.Workspace.regenspot.CFrame
end

Here is what I would do:

while true do
    print("bruhmoment")
    wait(1)
    local original = game.Lighting.light
    local copy = original:Clone()

    copy.Parent = game.Workspace
    copy.Position = game.Workspace.regenspot.Position
end

I changed the CFrame thing to the position of the regenspot.

If this helped please accept this answer.

2 comments

0

Both (yours and bostaff)'s solutions worked! Thank you!

0

No problem.

There are no primary parts in the copy's child. So I changed :SetPrimaryPartCFrame becomes CFrame.Vector3. By the way, you can just use while wait(1) do instead of putting wait(1) inside the while true do. There's also some adjustment needed:

while wait(0.5) do
    print("bruhmoment")
    wait(1)
    local original = game.Lighting.light
    local copy = original:Clone()

    copy.Parent = game.Workspace
    copy.Position.CFrame = workspace.regenspot.Position.CFrame
end

This is the best way to put the copy's position with a CFrame.

####Question: What is a primary part in ROBLOX studio?

A primary part is a group's children but which controls the whole group children's positions or CFrame value.

I will not tell you to do some hashtags before typing your word to change the word font XD

So if you have other questions, ask below the comment, or PM me in my profile! Anyways, see ya later :D

1 comment

0

-1, line 8

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