I have gotten help on using module scripts for spells but it seems not work and sends out this error. Im a little stuck on what im doing wrong and why the spell isn’t working so if anyone could help I would very much appreciate it.
Error:
15:28:11.875 Activator is not a valid member of ModuleScript "ReplicatedStorage.SpellsModules.Incendia" - Client - Controller:23
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local ReplicatedStorage = game.ReplicatedStorage
local Storage = ReplicatedStorage.SpellsModules
local UserInputService = game:GetService("UserInputService")
local Spells = {
["Incendia"] =
{
Launch = require(Storage.Incendia),
Activator = {
["type"] = "chat_message",
["content"] = "incendia"
},
Cooldown = 8,
Spell= "Incendia",
Magnitude = 30,
Magic = 60
}
}
for _, spell_config in pairs(ReplicatedStorage.SpellsModules:GetChildren()) do
local activatorConfig = spell_config.Activator
local activatorType = activatorConfig.type
if (activatorType == "input") then
-- use InputBegan connection and call whenever it is appropriate
UserInputService.InputBegan:Connect(function(input)
if (input.UserInputType == activatorConfig.input) then
spell_config.Launch.Execute()
print(""..activatorType)
end
end)
elseif (activatorType == "chat_message") then
-- use player.Chatted event
Player.Chatted:Connect(function(msg)
if (msg == "content") then
spell_config.Launch.Execute()
print(""..activatorType)
end
end)
end
end
return Spells
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local ReplicatedStorage = game.ReplicatedStorage
local Storage = ReplicatedStorage.SpellsModules
local UserInputService = game:GetService("UserInputService")
local spell_config = require(ReplicatedStorage.SpellsConfiguration)
local activatorConfig = spell_config.Activator
local activatorType = activatorConfig.type
if (activatorType == "input") then
-- use InputBegan connection and call whenever it is appropriate
UserInputService.InputBegan:Connect(function(input)
if (input.UserInputType == activatorConfig.input) then
spell_config.Launch.Execute()
print(""..activatorType)
end
end)
elseif (activatorType == "chat_message") then
-- use player.Chatted event
Player.Chatted:Connect(function(msg)
if (msg == "content") then
spell_config.Launch.Execute()
print(""..activatorType)
end
end)
end