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

MARIO 2D ROBLOX Need some help with a respawn for enemies, and coin problem, any ideas?

Hey There! This is my first post, so yeah!

Right, so I am in the process of making a full 2D Super Mario platformer game, and so far it's going alright! Here, ill tell you what I've done so far: Power up bricks (jump on them and they give you a power up) Goomba (That mushroom thing where you need to jump on its head to kill it, moves back and forth too) Spinning Coins (With "ding" sounds when you collect them) Jump boost (When touched you will jump high) Music (You know!) Fancy GUI A test level

So these are my current issues Goomba, just say if I kill him and I die later in the level, he remains dead, and doesn't respawn. I'm guessing the best way to fix this is to store him in ServerStorage, so when I spawn in he gets cloned from ServerStorage to workspace, and when he dies his clone gets destroyed, and when I die, he gets cloned yet again. But I'm not 100% on how to do this, and not exactly sure if this is efficient.

Secondly, and finally, this should be a singleplayer type game, aka each player has their own story. Here, let me explain it better, I've set the coin to Destroy when a player touches it (and get 1 coin in the leaderboard too) but if there was 2 players on this level, that coin would disappear for both players. Now I'm not sure if I should use .LocalPlayer for this script, or anything else but I am completely out of ideas on what to do.

Screenshot of game so far - http://imgur.com/CcduZYB

So yeah, these are my problems, and if anyone could lend a hand that would be greatly appreciated, thanks guys!

1 answer

If it is singleplayer, make the max players to 1. Second, how could you accidently script a respawn script? Putting him in serverstorage is still not helpful.

game.Workspace.Goomba:Destroy
--not like this below
game.Workspace.Goomba:Clone(game.Workspace)
game.Workspace.Goomba:Destroy()

:Destroy() will delete it from the game like deleting a part in studio.

1 comment

0

Thanks for the answer, where should I store him then?

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