#Stat point / class system help

3 messages · Page 1 of 1 (latest)

amber pelican
#

Im stuck trying to setup a stats/stat point system where a player would load data and i want to setup base stats but I dont know how to set it up where a player can choose a class and that class would give them different base stats

leaden badge
#

add a method of storing the current player data ( specifically their current class )
1. store the data within a script
or
2. store the data by creating a leaderstat folder and creating a "Class" stringValue inside of it
create a table o fall the classes with the stat value names and stat values in a regular script

local classes = {
  Class1 = {
    Health = 100,
    JumpHeight = 500
  }
  -- e.t.c
}

setup a gui with Buttons inside of it
upon clicking a button fire a remoteevent to the server with the info of the clicked button ( typically the buttons name, which would be the same as a specific class name for simplicity purposes)
add the onServerEvent in the regular script
add a function which sets/reloads the characters stats by searching classes for the specified class name

local function loadStats(player: Player,class_name: string)
  local humanoid = player.Character:WaitForChild("Humanoid")
  humanoid.Health = classes[class_name]["Health"]
  humanoid.JumpHeight = classes[class_name]["JumpHeight"]
  -- e.t.c
end

upon firing the remotevent run the function with the class name in it inside within thr eregular script
add a CharacterAdded event and make it run the function with the fetched class name the player currently has each time the character gets added so it can re-set the class values

#

my current method of doing it, but there's 100% a better way to do it so check devforums for a post similiar to your idea there will very most likely be one