How can I make an potion effect system?

Hello, I am trying to make effects for my game like a speed increase, jump boost, etc. I’ve tried using module scripts, but it would stop the other scripts activating the effect which isn’t what I want. (Somewhat like the effects Minecraft)

local function speedPotion(player)
     player.Character.Humanoid.WalkSpeed = 50


Here is a potion effect for you. It gives the player super speed (default speed is 16).

1 Like

yeah i know how to do that, but were would i store these? I don’t want to make a big junky script in every character. And also to give effects from tools, touching parts, etc.

You would put a Script in ServerScriptService for server side handling and a LocalScript in StarterPlayerScripts for client side handling.

1 Like

Alright, do i just put all the effects in there or add induvial scripts/module scripts for the effects?

I would make a module script called “PotionEffects” that returns a table of functions. Then you can call them from any Script.

I recommend you get to work on making the actual logic functions and not worry about where they go. You can always move them later. There are no strict rules.

You’re right. I always worry about making my scripts perfect xd

I’m exactly the same way. I know from years of experience that it is a huge hinderance to making anything. For years I would be constantly be thinking “but am I using the right kind of script?”, “but am I using the right kind of pattern?”, “but should it be class?”, “should I split it into two ModuleScripts or leave it as one?”, “should I learn a brand new pattern I know nothing about?”, “should I change this script that is already working properly?”. And I would never be able to make anything.

Many good games, even popular games have really crappy scripts. But at least they have a game. I realized it’s better to have bad scripts that might need to be changed later and a game, versus perfect pristine scripts and no game.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.