Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Module code did not return exactly one value???

Asked by 9 days ago

Here is module script:

CommandFunctions = {}
function CommandFunctions.Speed(Player, Speed)
    Player.Character.Humanoid.Speed = Speed
end
function CommandFunctions.Health(Player, Health)
    Player.Character.Humanoid.MaxHealth = Health
end
function CommandFunctions.Heal(Player)
    Player.Character.Humanoid.Health = Player.Character.MaxHealth
end
function CommandFunctions.God(Player)
    Player.Character.Humanoid.MaxHealth = math.huge
    Player.Character.Humanoid.Health = Player.Character.MaxHealth
end
function CommandFunctions.UnGod(Player)
    Player.Character.Humanoid.MaxHealth = 100
end
function CommandFunctions.RefreshCharacter(Player)

end
function CommandFunctions.LoadCharacter(Player)
    Player:LoadCharacter()
end
function CommandFunctions.Kill(Player)
    Player.Character.Humanoid:ChangeState(15)
end
CommandList = {
    {"speed",CommandFunctions.Speed(),{"Player","Number"}}
    ,{"health",CommandFunctions.Health(),{"Player","Number"}}
    ,{"heal",CommandFunctions.Heal(),{"Player"}}
    ,{"god",CommandFunctions.God(),{"Player"}}
    ,{"ungod",CommandFunctions.Speed(),{"Player"}}
    ,{"re",CommandFunctions.RefreshCharacter(),{"Player"}}
    ,{"refresh",CommandFunctions.RefreshCharacter(),{"Player"}}
    ,{"respawn",CommandFunctions.LoadCharacter(),{"Player"}}
    ,{"kill",CommandFunctions.Kill(),{"Player"}}
}
return CommandList

Here is exact errors:

17:55:47.169 - Module code did not return exactly one value
17:55:47.169 - Requested module experienced an error while loading
17:55:47.169 - Stack Begin
17:55:47.170 - Script 'Workspace.Goon's Admin', Line 2
17:55:47.170 - Stack End
0
I think you can only return functions on mudules Leamir 2715 — 9d
0
This is the wrong script. Fifkee 1981 — 9d

1 answer

Log in to vote
1
Answered by
Vid_eo 126
9 days ago
Edited 9 days ago

You're returning CommandList instead of CommandFunctions, which you defined at the start of the script. Instead of return CommandList, do return CommandFunctions.

return CommandFunctions --at the end of the script

If you want to access CommandList from other scripts, you can define CommandList as

CommandFunctions.CommandList = {}--insert table here

If this helps, please accept it as the answer!

Ad

Answer this question