Model stopped working

Hello, i have a game where you can spawn cars. The spawners worked for a while but now they stopped working. Script:

script.Parent.MouseButton1Click:connect(function(GetCar)
		Mod = game.ServerStorage.HHH     --Change test to whatever you have named the item you want to spawn
		clone = Mod:clone()
		clone.Parent = workspace
		clone:MakeJoints()
end)

The cars duplicate in workspace so i don’t really know why they don’t spawn. Maybe its my fault that i moved them somewhere.

3 Likes

Did you try using local before declaring your variables? Be more specific about what you mean by they “stopped working”. Try to attach a video of the problem so I can properly debug

Like the cars doesn’t spawn. There is a part and there is a text button on it which spawns a car in location where its set. But when i tried to spawn it next day it didn’t spawn.

1 Like

Are there any errors in the console? If so what are they?

Im not good at scripting so i just paste them. First one is GlobalUsedAsLocal: (2,3) Global ‘Mod’ is only used in the enclosing function defined at line 1; consider changing it to local and second one is GlobalUsedAsLocal: (3,3) Global ‘clone’ is only used in the enclosing function defined at line 1; consider changing it to local.

Well, do change them to local. That may be the root of your issue

local Mod = game.ServerStorage.HHH
--etc

but I meant when you run the game. Are there any errors in the debug console?

In game there are no errors but ill try to change them to local.

Maybe try positioning the model using MoveTo()

model:MoveTo(--Vector3: the position where you want it to spawn)

Where should i place this script? In model or car?

In the script, where you parented the model to workspace

Sorry i don’t understand scripting but i need to rename model to the car name? Because car and spawner isn’t called model i just called it here as model.

Yes, rename the variable of the car model

Then it says UnknownGlobal: (5,6) Unknown global ‘car name’

Thats because the game doesn’t recognize the global variable ‘carname’
try to change the variable to a local variable

local carname = path.to.carModel

It doesn’t duplicate in workspace that makes it not spawn.

May I see the entire script of the spawning system?
I couldn’t quite see the problem of the script

script.Parent.MouseButton1Click:connect(function(GetCar)
		local Mod = game.ServerStorage.BRICE     --Change test to whatever you have named the item you want to spawn
		clone = Mod:clone()
	    clone.Parent = workspace
	    BRICE:MoveTo(-172.15, 0.799, 517.5)
end)

Change BRICE to clone,
since the clone is the model you’re positioning

BRICE is car name. If that makes sense.

I referred to the car model clone variable, which isclone
If you put the actual car name, BRICE, the game will error since there is no variable of it. So the correct code should be:

script.Parent.MouseButton1Click:connect(function(GetCar)
		local Mod = game.ServerStorage.BRICE     --Change test to whatever you have named the item you want to spawn
		local clone = Mod:clone()
	    clone.Parent = workspace
	    clone:MoveTo(Vector3.new(-172.15, 0.799, 517.5))
end)