Problem with moving player

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want a player to move to the model’s primary part position when triggering
    proximity prompt

  2. What is the issue? Include screenshots / videos if possible!
    it gave me an error that says

 Workspace.Part.Script:13: attempt to index nil with 'PrimaryPart'
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I try to change primary parts to a part name but same thing happed

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
this is my code

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	game.ReplicatedStorage.Remotes.DressUp:FireClient(player)
	
	wait(1)
	
	local cam = workspace.CurrentCamera
	local char = player.Character
	local container = game.Workspace.Minimapobjects:FindFirstChild("Changing Room")
	
	char:SetPrimaryPartCFrame(container.PrimaryPart.CFrame ,container.PrimaryPart.CFrame.LookVector )
	
	print("done")
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Did you make sure to assign a primary part to the “Changing Room”

Yes,I checked it many time(((((())))

char:SetPrimaryPartCFrame(container.PrimaryPart.CFrame * container.PrimaryPart.CFrame.LookVector)

should work. I think the only problem is that u put , and there should be *.

now it gives a new error

Changing Room is not a valid member of Workspace "Workspace"  

Well than its your problem, the error explains it. You are trying to index an invalid object.

but the model’s already in workspce.even if I use

game.ReplicatedStorage:WaitForChild("Changing Room")

it gives warn

 Infinite yield possible 

Show me the picture of your workspace plese, so I can verify the model is in here. I can’t help you otherwise.

You mean my models in workspace or just workspcae??

The location you have Changing Room in. :slightly_smiling_face:

there

And you are getting it from ReplictaedStorage? That’s where the code doesn’t work?

Are you aware of the thing that you have it in a folder?

Yes i aware of that.but I just dont know how to call it if its a clone