Clone() Doens't work

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

  1. I’m trying to clone this amongus like so:
    image

2.But the problem is, when I press play, although the script cloned the model (itself), it didn’t clone the content within it. Here’s a picture

image

  1. So btw, I was writing this script when I was really tired so, I don’t if I made any mistake but, if you guys see me trippin somewhere then I apologise.

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!

So here’s the code

local Player = game.Players.LocalPlayer

local Cube = workspace.SUS:Clone()
Cube.Parent = game:GetService("Workspace")

local camera = workspace.CurrentCamera

I don’t know if something went wrong and if you can help me find it, it would be appreciated.

7 Likes

u should use WaitForChild on SUS as I think its children havent loaded when u cloned it

5 Likes

I think that’s maybe you got 2 “SUS” Model in workspace

3 Likes

Perhaps you could wait a while before cloning the model, it may be that the model has not been fully loaded.

1 Like
local Cube = game.workspace:WaitForChild("SUS"):Clone()

Cube.Parent = game.Workspace

This should be a regular script, not local, put the script into workspace

3 Likes

make sure it’s a script and not “Local Script”
make sure it’s in the model

and here’s the fixed code

local Cube = workspace:WaitForChild('SUS'):Clone()
Cube.Parent = game:GetService("Workspace")

local camera = workspace.CurrentCamera
2 Likes

Is the model “SUS” anchored? If no, is the model “SUS” got CanCollide set to true or false?

1 Like

well it would matter if the model had humanoid otherwise it doesn’t matter

1 Like

Is this a script?
If so then you should remove this since it only works in local scripts

local Player = game.Players.LocalPlayer

I also recommend you to open your output box since it may send an error about the usage of LocalPlayer

4 Likes

Well maybe the model could be falling out of the map or something. I don’t know if humanoids prevent things from falling out of the map or not.

2 Likes

well if the model had a humanoid it would get destroyed when it fell but without a humanoid it can fall but nothing would change.

2 Likes

You should probably clone it from ReplicatedStorage and parent it to the workspace once it has fully replicated and successfully cloned.

3 Likes

if the model will have any scripts then the scripts are gonna be broken when cloning it from Replicated Storage

1 Like

If so, then use events within the scripts. All the scripts will be complied on execution anyway, if there is no code that is required to run outside of scope (i.e. not within functions) then the events can be used freely to ignite functions within the scripts to actually do something. If there is code outside of function/module scope then it probably needs refactoring.

1 Like

yeah but who knows what he used or if he even has scripts in the model

1 Like

Clone the scripts into the model, ad-hoc and only when they are needed, from a location that will prevent them executing prematurely.

3 Likes

I tried this method but still resulted in the same problem, unfortunately, however thank you for your contribution, I apreciate it

I checked and I’m sure that I only have 1 “SUS” model in the workspace though, but thank you for your contribution

“WaitForChild” didn’t help, but thank you for your contribution

this may sounds very convincing at first, however, when I look at one of my older scripts, which I use a module script to run the clone method and passing in the object from a local script just like so
– local script


–ModuleScript
image
image

and it works fine