House cloning not working

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 to make when a button clicked it will check if the button name is equal to the house name that parented inside a folder in replicatedstorage. If it’s equal then the house will clone

  2. What is the issue? Include screenshots / videos if possible!

Cloning not working. The script only works until at line 11

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried to use value but nothing happens

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:

local motherframe = script.Parent
local house = game.ReplicatedStorage.House:GetChildren()


script.Parent.Activated:Connect(function()
	print("HAHAHAHHA")
	local player = game:GetService("Players").LocalPlayer
	for i , houses in pairs(house)do
		print("hehehehehe")
		if houses.Name == motherframe:WaitForChild("Name").Value then
			print("hohohohoho")
			local clone = houses:Clone()
			clone.Parent = game.Workspace:WaitForChild(player.Name.."Stuff")
			for i , v in pairs(game.Workspace.PromptInterract.HouseOwning:GetChildren())do
				local value = v:WaitForChild("PlayerPlcae")
				if value == player.Name then
					print("haihiahiah")
					clone:SetPrimaryPartCFrame(v:WaitForChild("HouseSpawnPart").CFrame + Vector3.new(0,8,0) , v.CFrame.LookVector)
					print("huhuhhuhuh")
				end
			end
		end
	end
	
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.

Is this a server script or a local script? If it’s a server script, you should remove this line as LocalPlayer property can only be accessed by the client.

its a local script (aaaaaaaaa)

So is your planning is cloning the house and let everyone see the house or only the client?

So is your planning is cloning the house and let everyone see the house or only the client?

everyone

Then you shouldn’t do this in a local script, because one, no one can see your house except your view and two, clients can’t access server-sided things.

then do I need to use serverscript

Yeah, you should’ve use a server script to do this.

I just put a print on every line and the problem starts with this line

for i , v in pairs(game.Workspace.PromptInterract.HouseOwning:GetChildren())do
`

Use a Remote Event.

Or if it is just a click detector handle the whole thing on the server.

but where do i need to parent it … the button or serverscriptservice??

Since your script states script.Parent, you might as well just parent to the Click Detector.

the house is cloning but the problem is that the house is not move to the position

also problem is start at this line:

for i , v in pairs(game.Workspace.PromptInterract.HouseOwning:GetChildren())do
``

WELP…nvm it already work. Btw thanks for helping .Also do I need to Solution this topic??

No need to, but it’s a great idea for people who are searching help on the same topic.