Wheel Module
In your wally.toml file, add this to your dependencies:
You have two solutions to import this module, depending if you wish to import the Controller or the Service on your own, or if you let the module give you the right code.
Configuration
A file called WheelModule.config.lua is to be created in ReplicatedStorage/Shared/Configs.
Explanation:
Index: The index represents the type of wheel
Tables: A list of rewards
name: The name of the item / currency to give
amount: The amount of the item / currency to give
type: The type of item to give (Can be anything, it depends on the rest of the code)
odds: The chances of said item the drop. The drop rate depends on the total amount (so if all your odds adds up to 100, it will be in %)
amountType: Can be used to determine if the reward is to be given in fixed amount or in % of what you currently have.
Usage
Events
OnWheelSpin: Triggers when the player start to spin the wheel.
OnWheelSpinCompleted: Triggers when the item is sent to client
OnWheelSpinCompleted: Triggers when the item is sent to client
Methods
Server Side
Explanation
player: The player that spun the wheel.
type: The type of wheel to spin
Client Side
Explanation
singleAngleSize: The size of the angle of a single item on the wheel. (They should all be the same)
fullSpins: The number of full spin the wheel does before landing on the item.
index: The index of the obtained item.