Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

Why can't I clone a model with this script. How would I clone this model?

Asked by 8 years ago
Edited 8 years ago

I am trying to make a car spawner into a tool and I'm trying to clone the car and this isn't working. There are no errors and everything works but the cloning. Assets is a folder if that changes anything.

01local tool = script.Parent
02local clickEvent = tool.ClickEvent
03local spawnblock = game.Workspace.spawnblock
04local clickEventConnection
05 
06local function createPart(location)
07    local work = game.Workspace
08    local car = game.ReplicatedStorage.Assets.Car
09    car.Parent = work
10    car:MakeJoints()
11    work.Car:MoveTo(spawnblock.Position)
12    work.Car.Archivable = true
13    work.Car:Clone().Parent = game.ReplicatedStorage.Assets
14end
15 
View all 25 lines...
0
This entire script is all sorts of wacky rollercoaster57 65 — 8y
0
My friens wanted me to make a car spawner into a tool for his group. This is part of the script. MrMinecraft998887 87 — 8y
0
This is even worse,. Let me write you a whole new script. rollercoaster57 65 — 8y
0
wait, do you want the car to spawn where the player clicked or where the block is? rollercoaster57 65 — 8y
View all comments (3 more)
0
where the block is MrMinecraft998887 87 — 8y
0
I updated my solution because now I now just about everything iu need to know. I will test it out real quick to rollercoaster57 65 — 8y
0
I got it to work but the car needs to be reqelded after it's made. LIke its comletly anchored then welded the unanchored. Maybe you can figure out how to do that through a script though. rollercoaster57 65 — 8y

3 answers

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

This entire script is all sorts of wacky.

1local work = game.Workspace --no, you can use workspace as its own now
2local car = game.ReplicatedStorage.Assets.Car
3car.Parent = work
4car:MakeJoints() -- no, pointless if you try to move anything
5work.Car:MoveTo(spawnblock.Position) --no, thi is only a humanoid object fuction
6work.Car.Archivable = true --no, its already set to true
7work.Car:Clone()
8work.Car.Parent = game.ReplicatedStorage.Assets

No thats covered, my solution.

Get a welding plugin, I recommend Jojomen56's utility plugin, then weld the car to itself.

now myour new script

01local tool = script.Parent
02local spawnblock = game.Workspace.spawnblock
03 
04function createPart(location)
05    local work = game.Workspace
06    local car = game.ReplicatedStorage.Assets.Car
07    car.Parent = work
08    work.Car.basepart.Position = location --change basepart to watever the part is that everything is welded to
09    work.Car:Clone().Parent = game.ReplicatedStorage.Assets
10end
11 
12 
13tool.Activated:connect(function()createPart(spawnblock.Position +Vector3.new(0,5,0))end) --to avoid colliding with anything, we put it a little above

Also be sure it's either in a hopper bin or a tool with handle disabled

0
This works but the car can't move MrMinecraft998887 87 — 8y
Ad
Log in to vote
1
Answered by 8 years ago

You forgot to set a variable to the new cloned version.

01local work = game.Workspace
02local car = game.ReplicatedStorage.Assets.Car
03car.Parent = work
04car:MakeJoints()
05work.Car:MoveTo(spawnblock.Position)
06work.Car.Archivable = true
07work.Car:Clone() --Need to set a variable to this
08work.Car.Parent = game.ReplicatedStorage.Assets -- Referencing the old one still
09 
10local work = game.Workspace
11local car = game.ReplicatedStorage.Assets.Car
12car.Parent = work
13car:MakeJoints()
14work.Car:MoveTo(spawnblock.Position)
15work.Car.Archivable = true
View all 30 lines...
0
No he did, but what hes doingis pulling the car from storage then putting the clone into storage rollercoaster57 65 — 8y
0
This didn't do what I wanted it all to do MrMinecraft998887 87 — 8y
Log in to vote
-1
Answered by 8 years ago

Remove line 8 and put this at line 7 work.Car:Clone().Parent = game.ReplicatedStorage.Assets

0
That doesn't work MrMinecraft998887 87 — 8y

Answer this question