Can we clone a seat?

I tried to clone a model including seats several times, using Clone().
I can clone parts, but the seats do not work properly.
(nothing happens when I touch the seats).

My original model is in Replicated Storage and
I clone it to Workspace.

So I just want to know if we can clone a seat with keeping the seating function.

1 Like

Try to change the parent of the model to serverstorage and edit the code.

1 Like

I fail to clone if I put a model in ServerStorage. I tried both of WaitForChild() and FindFirstChild().

Give a bit of information, where is the script that is doing the cloning, can you show the cloning and parenting code, what triggers the player to sit in the seat, or is it just default touch?

1 Like

I am developing a kind of Claim-A-Room system.
I want to clone an interior set if a player claim a room.

local nagaya = game.Workspace.MunewariNagaya
local players = game:GetService("Players")
local player = players.LocalPlayer
local userId = player.UserId
local image = players:GetUserThumbnailAsync(userId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150)
--local RS = game:GetService("ReplicatedStorage")
local SS = game:GetService("ServerStorage")
local interiorSet = SS:FindFirstChild("InteriorSet")



for _, each in pairs (nagaya.NamePlates:GetChildren()) do
	
	local frame = each.SurfaceGui.Frame
	local nameLabel = frame.NameLabel
	local imageLabel = frame.ImageLabel
	local PP = each.ProximityPrompt
	
	
	if each.Owner.Value == "" then
		PP.Triggered:Connect(function()
			
			--Check if the player already has a room or not. If so, unclaim it.
			for _, ownedRoom in pairs (nagaya.NamePlates:GetChildren()) do
				if ownedRoom.Owner.Value == player.Name then
					local ownedRoomFrame = ownedRoom.SurfaceGui.Frame
					ownedRoom.Owner.Value = ""
					ownedRoom.InteriorSet:Destroy()
					ownedRoomFrame.NameLabel.Text  = "Unclaimed"
					ownedRoomFrame.ImageLabel.Image = ""
					ownedRoom.ProximityPrompt.Enabled = true
				end
		
			end
			
			--Set a new room for the player
			each.Owner.Value = player.Name
			nameLabel.Text = player.Name
			imageLabel.Image = image
			PP.Enabled = false
			
			local cloned = interiorSet:Clone()
			cloned.Parent = each
			cloned:PivotTo(each:GetPivot())
			
		end)
	else
		PP.Enabled = false
	end
end

I use only a local script and put it in StarterPlayerScripts.
Do I need to use a server script?

image
Green is looking in Replicated Storage, Pink is looking in Server Storage

image

when I touch each, they spawn a model with a seat…
image

They both allow for default sitting
image
image

here is the code for the replicated storage one

local debounce = false
script.Parent.Touched:Connect(function(part)
	local player = game.Players:GetPlayerFromCharacter(part.Parent)
	if player and not debounce then
		debounce = true
		local pet = game.ReplicatedStorage:WaitForChild("Aminal"):Clone()
		pet.Parent = workspace
		wait(5)
		debounce = false
	end
end)

and here is for server storage

local debounce = false
script.Parent.Touched:Connect(function(part)
	local player = game.Players:GetPlayerFromCharacter(part.Parent)
	if player and not debounce then
		debounce = true
		local pet = game.ServerStorage:WaitForChild("Aminal"):Clone()
		pet.Parent = workspace
		wait(5)
		debounce = false
	end
end)
1 Like

It will take me a while to process what you put, but just off the bat, there is an error with cloning it looks like in that first screenshot, you should take care of the error then see where you are after that.
image

1 Like

On line 8, I changed FindFirstChild to WaitForChild.
Then, no error message but still not work.

Yes, use a server script.
Checks for things like ownership when spawning things into the game, need to be on the server.
If you are wanting it to only be visible to the player who spawned it, have the server script send an remote event to the client, then let the client spawn it.

So, is it actually putting the objects in workspace? as in, can you see them, just the seat parts arent working?

I will try in my demo, to see if cloning from a client script will make any difference.

1 Like

Ok, I tried to clone from a local script from replicated storage, and you are correct, it did not allow the seat to function
image

1 Like

So, if you want other players to see the furniture and sit on the furniture, have it cloned and parented from a server script, with the model in server storage, and you’re good

If you want the furniture to only be seen by the spawning player, you should do your owner checks on the server, send a remote event to the client, have the client spawn the furniture from the replicated storage and have a local script that will check the ‘touched’ condition of custom seat parts (a part you designate as a seat) and have the local script check if you touch a custom seat part then… do these steps
Weld the player to the seat part
Play the sitting animation at a high priority
check for Humanoid state being Jump, to break the weld

1 Like

I use a server script and put it in ServerScriptService.
Then I confirmed it works properly
when the original model is in either of Server Storage and Replicated Storage.

Thank you so much for your kind and neat help and advice!

1 Like