[CHANGES] Spill System | Version 1.1.2.1 (Made for cafes)

Hey, community!

I made this easy-to-use spill system for newly created cafes or whoever needs it if you don’t feel like making your own. It comes with a settings module to quickly edit the critical things in the system. It didn’t take me long, and the code is kind of messy, so please forgive me.

Notes:
This system does require you to do a few crucial things to work correctly, but they will all be inside the model; you will have to parent some stuff. The way spills spawn, the script randomly picks an area (a part) inside a folder, and it obtains a random CFrame inside of that part to generate the spill in that area. If you want to change the distance needed to clean a spill, you can change the MaxActivationDistance property inside of the ClickDetector, as it goes off of that.

Changelog (1/7/2022):

  • Added a DataStore system to save player currency easily.

  • Added a new setting inside of RewardSettings called DefaultValue; if the datastore can’t find player data, their points will be set as the amount.

  • New setting called DataStoreSettings:

    • DataStoreEnabled - By default, it will create a datastore for the currency. Ex. Points
    • DataStoreName - Changing this will reset the datastore value.
    • CreateStats - By default, this will create the stats found in RewardSettings
  • NOTE: To use the new system, you will need to redownload the model, or just copy and paste the new SpillHandler code into your old one.

Changelog (1/3/2022):

  • Converted to a module, so you don’t have to get the new model each time changes are made.

  • Added an “IsSpecial” value inside the tool configuration; used for bypassing the clean time when someone else stops cleaning the spill—used for Golden Mops and such.

  • Made it so if they unequip their tool midway through cleaning, it stops cleaning, and anyone can finish cleaning the spill.

  • New setting inside of SpillSettings called “DeleteOnUnequip” allows you to choose if spills should be deleted when a player unequips their tool.

  • Updated the LocalScript, so all you have to do is insert the one into StarterPlayerScripts, and it’ll work for all your tools.

Instructions:

  • Insert the “SpillFolder” into the workspace; there is a folder named “SpillFolder” inside the model that should be inserted into the workspace, which has two folders inside it. You can clone the part inside the “Areas” folder to make multiple areas.

  • Place the “Events” folder into ReplicatedStorage.

  • Place the “SpillHandler” script into ServerScriptService.

  • Place the LocalScript (ClientClick) into StarterPlayerScripts, and all you have to do is make sure whatever tool you’re using is inside of the ToolsName section of the settings. You can watch the installation video below to learn how to add more tools if you don’t know-how.

Now, everything will work like that, but you most likely want to make a few customizations, so let’s get into that!

Configuring the main script:
You’ll see a few things that you can modify; I’ll try to go over the one most might want to edit.

  • DataStoreSettings

    • DataStoreEnabled - By default, it will create a datastore for the currency. Ex. Points
    • DataStoreName - Changing this will reset the datastore value.
    • CreateStats - By default, this will create the stats found in RewardSettings
  • Group Configuration

    • GroupId; if you want to make this system only work for those of a certain rank in your group, you want to use this. Instead of having the value as nil, you need to insert whomever group you want to use id there. Leaving the value as nil will allow everyone to clean spills.

    • GroupRank; this is the rank that is allowed to clean spills (you can find this in your group settings.)

  • SpillSettings

    • MaxSpawnedAllowed; is the max amount of spills that are allowed to be spawned at once.
    • SpawnWaitTime; whatever the value is set to, spills will spawn every time elapsed.
    • PathToSpill; if the spill isn’t in the default folder, change this to the spill’s path.
    • DeleteOnUnequip; if true, the spill will delete if the player is cleaning it and unequips their tool.
  • RewardSettings

    • FolderName; the default value is set to “leaderstats” as that is where most store their points value. You may change it to the folder’s name where the value is. Please note, whatever this is set to, the script will search the player for the folder, so if your folder is inside of another folder, that will not work right now as I didn’t add it.

    • StatName; the default value is set to “Points” but can be changed to whatever. It will not work if this value is not found inside the folder given in the FolderName setting.

    • DefaultReward; the default amount which should be rewarded when cleaning a spill.

  • ToolNames

    • Inside of here should be tables that should store the tool’s name, the multiplier (like Golden Mops), and the clean duration. I’ve left examples in the script for further help.

Changing the spill
Changing the spill is quite simple; make sure you insert the ClickDetector, and the BillboardGui (CleaningProgress) found inside the default spill into the main one and, of course, change the PathToSpill settings if you changed the path or name.

Get the model
I think I’ve covered all of the things this model requires, but if you need any further assistance, you are more than welcome to message me on the DevForum. If you found any bugs or anything related to that, you can also message me on the DevForum or post a reply so that I can fix them.

You can get the model here: https://www.roblox.com/library/8437454042/Spill-System-V1-0-0
Source Code: https://www.roblox.com/library/8444816967/Spill-Handler-V1-Source

Installation Instructions:

23 Likes

could you put some videos or screenshots in the post so we know exactly what you mean before we take this model?

4 Likes

Added a video of it being used. I may make a setup tutorial video if requested. Thank you!

You should do that. Some people prefer to learn from video rather than text

2 Likes

I kind of thought so too, I just wanted to see if needed, but I should do it to limit any troubles with installation. I’ll start working on the video now. Thank you!

1 Like
  • Added two new videos; an installation tutorial and a short video of the system.
1 Like

A few new changes to the script and a new installation video showing how to install it the new way.

1 Like

Sorry if I’m an idiot but I don’t get what this does

1 Like

It’s used for cafes, bakeries, etc., types of games.

1 Like

Ok how to use it ???

1 Like

I posted an installation tutorial video on the thread; if you need more help after watching it, you can DM me via the DevForum. :slight_smile:

1 Like

Added a new datastore option to create and save the player data if needed.

Changelog (1/7/2022):

  • Added a DataStore system to save player currency easily.
  • Added a new setting inside of RewardSettings called DefaultValue; if the datastore can’t find player data, their points will be set as the amount.
  • New setting called DataStoreSettings:
    • DataStoreEnabled - By default, it will create a datastore for the currency. Ex. Points
    • DataStoreName - Changing this will reset the datastore value.
    • CreateStats - By default, this will create the stats found in RewardSettings
1 Like

When i take the model the events folder isnt there at all

1 Like

Thank you for the report! I removed the events folder by mistake when doing the previous update; it has been fixed and should work properly when the model is reinserted—apologies for the inconvenience.

2 Likes

Hey, thanks for your suggestions. I appreciate them!

I don’t quite understand the part where you said, “allow the user to set a number of spills on server startup, say they have a large cafe and they only want them spawning every minute and only have 20 spills, it will take 20 minutes for them to fully spawn.” I do understand the on-server startup part, but not the second half. Inside the main script of the model, there is a table that allows you to change settings for the spills, such as the max spills allowed and the wait time for when a spill should be spawned. After the wait time is over, it will check to see how many spills are generated; then, if there are less than the set amount, it will spawn a new one; otherwise, it will just go through the cycle again.

As far as the command for high ranks, I think that will create a path for people to abuse the system and their points, so that will most likely not be added, but if other people do want it, I will for sure add it.

Thanks,
Nicholas

Thanks! a bit of a cosmetic suggestion but maybe you could implement a feature where the spill has a random color and orientation to add some variety?

Thanks for your suggestion; I appreciate it! I was thinking the same things, but also including different spill rarities for people to enable. If I did add it, it would spawn rarely and give a specific cash multiplier to the one who cleaned it.

Thanks,
Nicholas

1 Like

Seems like a very good spill system I will be using this for my cafe.

The only thing I very much dislike is that it prints a ton of stuff in console, which might not be a big issue for some but the only thing I want in my console is if a script is getting an error.

Edit: My mistake, I see the spot where you can disable print changes. But it still prints something else about requiring an id, which Id also preferably wants disabled.

I also very much like @chrisvecs suggestion about implementing a feature where the spills are randomly coloured.

2 Likes

Hey, Lancmo!

The thing about requiring the id is on Roblox’s side, and I cannot control that. If you’d like, you can grab the source code and require it from inside of your game, but you would have to do that for every update I make. Regarding your other suggestion about colors, I will definitely add an option for people to add random colors soon!

Thanks,
Nicholas

1 Like

I never knew that so I’ll keep it require as having to update every time would definitely get annoying.