Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you a value from ServerScriptService?

Hello, I am making a GUI which displays custom leaderboard stats, So I have a leaderboard in ServerScriptService and I put there "IntValue" inside the leaderboard script and made a simple code inside there which is

script.Deaths.Value = "Deaths"
  • Deaths is a Variable * This simple script updates the "IntValue according to the number of deaths so how do I get a Gui Label to update the text according to the number of deaths here's my attempt
local Deaths
game.ServerScriptService.KillsDeaths.Deaths.Value = Deaths
script.Parent.Text = Deaths --Local script

And I am a complete newbie so I suck at programming Lua

1 answer

I don't know what you're trying to do with your first code, but correct me if I'm wrong. I understand that it's an IntValue you're changing; therefore you cannot have a string as the value.

In your second script, I think you're trying to define "deaths" as the number of deaths. Order matters though. You hadn't defined deaths yet on your first line. Then I think you tried to do it on your second line, but you made the value = deaths instead of deaths = the value. I'll give you an example of how order matters here:

local health = 50
local newHealth = 100

health = newHealth -- This will make health become 100 but this does not change what newHealth is

newHealth = health -- This will make newHealth become 50 but this does not change what health is

So this is what your second script should look like:

local Deaths
Deaths = game.ServerScriptService.KillsDeaths.Deaths.Value
script.Parent.Text = Deaths --Local script

This discussion is preserved as it was. New answers, comments, and votes are closed.