Hey, so right now I am working on a abilitymanager module script with stats and a moveset set in the player. Now that moveset is stored in a stringValue of which I thought is the way I should do it.
For some reason I always get nil as the parameter at where I want to change this value
-- this is in the module script
function AbilityManager:ChangeAbility(player: Player, abilityName: string)
if type(abilityName) ~= "string" then
warn("Invalid ability name type:", typeof(abilityName))
return
end
local abilityData = MoveSets[abilityName]
if not abilityData then
warn("Ability not found:", abilityName)
return
end
local stats = player:WaitForChild("PlayerStats")
stats.Ability.Value = abilityName
end
--this is in the server script
Player.PlayerAdded:Connect(function(player)
playerData[player.UserId] = Abilitymanager:CreateNewInfo(player)
local set = MoveSets[player.PlayerStats.Ability.Value]
Abilitymanager.ChangeAbility(player, "TestMoveset2")
end)
And this is how the movesets are stored
local MoveSets = {
TestMoveset1 = {
{["Name"] = "Test1", ["Cooldown"] = 5, ["Input"] = "E"},
{["Name"] = "Test2", ["Cooldown"] = 5, ["Input"] = "R"},
{["Name"] = "Test3", ["Cooldown"] = 5, ["Input"] = "T"}
},
TestMoveset2 = {
{["Name"] = "Test1", ["Cooldown"] = 5, ["Input"] = "E"},
{["Name"] = "Test2", ["Cooldown"] = 5, ["Input"] = "R"},
{["Name"] = "Test3", ["Cooldown"] = 5, ["Input"] = "T"}
}
}
return MoveSets
I think it is a type but I tried changing it to a string and using .Value but it still give nil.
Thank you for reading.