Need Help in making a Harry Potter Wand system

Hi, so I’m currently trying to make a Harry Potter Wand system like this where you type a spell in chat then you can click to launch the spell. Is there an efficient way to do this without having a whole bunch of server scripts and so many lines in a local script for each spell? I guess I could put them in a Module but I have no idea how that’d work. I’ve already made the projectiles so just loading the spell is my issue now.

2 Likes

Modules would be the best way to do this, just have a module for each task, projectiles, etc.

Yea but I need to find a way to load them by chatting a valid spell

do you mean you want to detect when the player types a certain string into the chat? This document goes over texts well and this one explains modules. PS. watch out for the roblox chat filter. :smiley:

2 Likes

I wrote a sample code for you, perhaps it might help you understand the usage of modules.

image

Spells.lua (ModuleScript)

local Spells = {}

function Spells.SomeSpellName(paramTest)
	print(paramTest)
end

function Spells.AnotherSpellName()
	print("Another spell I guess")
end

return Spells

Wand.lua (LocalScript)

local Spells = require(script.Spells)

Spells.SomeSpellName("Hello World")
Spells.AnotherSpellName()
3 Likes