I was wondering if someone might help me out. I have a script where it regens model ships when you say "regen 1, regen2" etc. But the problem I have is that if I dont have the regen process delete the existing ship, it will cause too much lag to my game. What I would like is to have a limit on the script. So just something that will read to see if there is a maximum of four ship models (with that specific name) already in the workspace. If there are four, it will display a message saying "There are too many ships of this type in the game already" or something (doesn't NEED this, but it would be helpful) But if you have a way of doing this, it would be helpful, thanks. And I will be sure to give credit for your help in the desc.
My script:
model = game.Workspace.ship03 backup = model:clone() function onChatted(msg, recipient, speaker) local source = string.lower(speaker.Name) msg = string.lower(msg) if (msg == "regen3") then model:remove() model = backup:clone() model.Parent = game.Workspace model:makeJoints() end end function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end game.Players.ChildAdded:connect(onPlayerEntered)