✓ Accepted answer
So, to expand on my comment and explain it better. I recommend putting the model in ReplicatedStorage. This is extremely useful, it doesn't cause lag plus its always there when you need to clone it again! There's different ways to go about respawning (aka cloning) the model after this so below I will provide you with what I personally use.
Also I highly recommend checking out this link!
https://developer.roblox.com/en-us/api-reference/class/ReplicatedStorage
local model = game.ReplicatedStorage.Cars.RedCar1
while true do
wait(5)
backup = model:Clone()
backup.Parent = game.Workspace
backup:MoveTo(Vector3.new(-105.042,203.5,100.995))
end
Here's a on touch script that works!
local model = game.ReplicatedStorage.Cars.RedCar1
wait(1)
function onTouched(hit)
local check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
script.Parent.CanTouch = false
script.Parent.Transparency = 1
script.Parent.CanCollide = false
local backup = model:Clone()
backup.Parent = game.Workspace
wait(5)
script.Parent.CanCollide = true
script.Parent.Transparency = 0
script.Parent.CanTouch = true
end
end
end
script.Parent.Touched:Connect(onTouched)
I hope this helps you. I'm happy to help. If you have any questions don't hesitate to ask.
1 comment
You can always put the model in ReplicatedStorage. That's what I personally do and would recommend.