|
| 31 Mar 2017 11:06 PM |
I am currently working on a semi-open world RPG story based hack and slash game, and I'm in need of help with how to implement stats onto a player.
I plan to use the Value Objects (IntValue, BoolValue, etc. Those guys) to be the actual place holder for the stat.
For example: Strength = game.Workspace.NumberValue.Value
Is there a way where I would be able to move each value object from workspace (or lighting) into a player? That way I can make armors and weapons correspond with the stats on the player that possess them |
|
|
| Report Abuse |
|
|
| 31 Mar 2017 11:39 PM |
1.) don't use lighting for storage of anything. It is lighting, not ServerStorage. 2.) Do not use XValues 3.) You are best off using locals unless you want a variable to persist out of functions 4.) You should learn to do some FilterEnabled, doing so will allow you to keep the values about a player in a single script. This script would be your daemon. Other scripts would affect the environment or communicate with the main place script. 5.) When a player dies, the whole game.Workspace.PlayerName model is reset. The items you put into it wouldn't persist.
If you decide to use the method you are doing, it would be wise to name your object accordingly. This way you can do game.Workspace.PlayerName_Strength.Value.
So like,
local makeStats = function(plr) local Strength = Instance.new("IntValue") Strength.Name = plr.Name .. "_Strength" Strength.Parent = Workspace
-- et cetera end
game.Players.PlayerAdded:connect(function(plr) makeStats(plr) end)
and corrections to this method is, you should be putting these in the game.Players.PlayerName.leaderstats so that you can record the information in a leaderboard if you want. If not, don't put them inside a leaderstats IntValue. |
|
|
| Report Abuse |
|