Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

When I clone a part from ReplicatedStorage it disappears after a second. How do i fix this?

When a player presses a button on a GUI it fires a remote event and the server script picks it up and launches this code, But when it spawns into the workspace it disappears after a second.

local remote = game.ReplicatedStorage.SpawnCar

local function SpawnCar()
	game.ReplicatedStorage:WaitForChild("Car"):Clone().Parent = game.Workspace
end

remote.OnServerEvent:Connect(function(player)
	print("received")
	SpawnCar()
end)

I found out the when the parts of the car is grouped and I clone that it does not disappear but I need the parent to be a part so I can CFrame the car to the player when it spawns in

11 comments

0

can the car fall into the void and destroy itself? try using :SetPrimaryPartCFrame to move the car into position from which it won't fall

0

that's not it because the car falls onto the baseplate and I can drive it for a second and then it deletes it self. Thanks for the suggestion though

0

it can be because a dfiferent script is removing the car, check for :Destroy in other scripts

0

Is there a script inside the car which is destroying the car?

0

I just checked I did not put a :Destory() into the car accidentally

0

or anywhere else

0

if you drop me .rbxl file of the place on discord i'll save your butt nob :)

0

i'm not doing that i have too much work in this game and i'm not going to trust you

0

ok, try Ctrl + Shift + F in studio to search all and search for :Destroy or Debris:AddItem, both of these can remove your car

0

the is none that have to do with the car getting deleted

0

Are you moving an invisible part whose child is a car model? Or it's a part of a car model? Anyways, try using Model:SetPrimaryPartCFrame(CFrame)

1 answer

Alright so i'm not sure what i did exactly but i remade my car and rewrote my car script and it works now? i have no idea why but thank you everyone for trying to help me fix this bug :)

This discussion is preserved as it was. New answers, comments, and votes are closed.