Sorry for the long topic.
Hi There! I’m creating a obby called Hell Obby 2, a obby consisting of 100 unique levels, breaking the convetional rules of an obby.
Anyway, i’m creating stage 15, in which the player must ride a motorcycle, and try to survive to the end.
I’ve done almost all of the scripting, i only have a problem, with the spawning of the motorcycle.
Basically, right now, when a player respawns the motorcycle (Cloning the sample in the ServerStorage) Any Clone that exists will be destroyed, just a little problem: The game is a multiplayer game, and i need to create various motorcycles for it to be beaten without long wait times or spammers.
Not Destroying any clones is not an option, due to the fact that a player can spawn 2 motorcycles in the same spot, seriously bugging the game, also, he can create multiple motorcycles, to slowndown the game.
Here is the script that i’m using right now:
location = game.Workspace
regen = game.ServerStorage.Vehicles.Motorcycle
save = regen:clone()
back = nil
function onClicked()
if back ~= nil then
back:remove()
end
back = save:clone()
back.Parent = location
back:MakeJoints()
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
So, basically, i want it so the the script i showed to do the following:
- Destroy any motorcycles close to the new motorcycle.
- Not allow motorcycle spawn if number of motorcycles is equal to the number of players.
- And all of the functions that it already has.
Thanks for reading, if you have a solution, please answer to this Topic.
Once again, sorry for the long topic.