Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Please help with these Physical Values?

Asked by 7 years ago

Ok so i'm creating a Pokemon Game (a really good one) and TimeTicks gave me his Physical Values that automatically save but i don't really get how to use them. Normally i would do those 'game.Players.LocalPlayer.leaderstats' but these are in workspace>player model>a folder named stats with stats in them. I don't know what i would put in the script to say if those physical value stats were over 5, then a gui would appear but i can do the gui part. Please help. The value that need to be over 5 is 'Level'.

This is the script that creates the folder in the workspace model of themself. local PlayerData = game:GetService('DataStoreService'):GetDataStore('PlayerData')

local PlayerStats = { Stats = { Level = 0, PokeCoins = 0, XP = 0, }, }

local DataHandler = {}

LoadStats = function(Player) for i,v in next, PlayerStats do local Stats = Instance.new('Folder',Player) Stats.Name = i for key,val in next, v do local Int = Instance.new('IntValue',Stats) Int.Name = key Int.Value = val end end end

SaveStats = function(Player) local Stats = Player:WaitForChild('Stats') for i,v in next, Stats:GetChildren() do PlayerStats[Stats.Name][v.Name] = v.Value end end

DataHandler.LoadData = function(Player) local UserId = Player.UserId local Data = PlayerData:GetAsync(UserId) if Data then PlayerStats = Data else PlayerData:SetAsync(UserId,PlayerStats) end LoadStats(Player) end

DataHandler.SaveData = function(Player) local UserId = Player.UserId SaveStats(Player) PlayerData:SetAsync(UserId,PlayerStats) end

return DataHandler

0
please help :C EvolutionPower 0 — 7y
0
pls use code block. User#5423 17 — 7y

Answer this question