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

How to do: Stats?

Asked by
lomo0987 250 Moderation Voter
10 years ago

i'm going to be looking into a game where you can do upgrades such as maxhealth and walkspeed.

How I would like to do this is have IntValue's and have scripts work off them and update them as needed. (Such as buying an upgrade)

I feel like there is 2 things that i'm going to need to learn, how to update their humanoids when they join and when they respawn according to the IntValue's inside the players. (Also going to need to learn how to save them when it gets updated and load when a player joins again)

I also feel like i'm going to need to have the local scripts inside StarterGUI.

Is anyone willing to explain everything that I would need to learn or provide me with wiki links for what I will need to learn?

1 answer

Log in to vote
-1
Answered by 10 years ago

This is perfect. +1 me.

-Messing with Int Values and Data Persistance https://www.youtube.com/watch?v=-BCuOiM14lA

You shouldnt use IntValues for everything. BUT I prefer you'd put them in player or in a model in player

-To do something when they spawn (in the player id prefer you'd put a script that would wait for a bool value in the player when the data loads so it doesnt excecute before data is loaded thus creating false info)

-Haven't tested the code below

function GetStats(directory,value,human)
    local DataDirectory = directory.Parent.PlrDataReady
    while DataDirectory == false do
        wait()
    end
    if directory.Value == value then
        --human.WalkSpeed     Do Stuff Here
    else
        print("Conditions not met by "..plr.Name..".")
        print("Condition: "..value.." "..directory.Name)
    end
end


game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(chr)
        GetStats(plr.Rank,"General",chr)
        GetStats(plr.Rank,"Administrator",chr)
        GetStats(plr.Cash,200,chr)
        GetStats(plr.Job,"Real Estate Agent",chr)
    end)
end)

+1 :D

0
I don't understand the code provided above. And for the link for youtube, I would prefer wiki. I don't like to wait around watching a video that explains things at 1 speed. lomo0987 250 — 10y
Ad

Answer this question