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

Help Finding leaderstats???

Asked by 10 years ago

I have the following:

StarterGui ScreenGui Frame TextBox Script

I want to find the Player's leaderstats (Or leaderboard, as some of you call it), would it look like this? If not, how would it look like?

-- PATH FROM TEXTBOX
player = script.Parent.Parent.Parent.Parent.Parent.leaderstats -- Then comes the currencies

I want to find the player that this Gui is in, Not any other player...

2 answers

Log in to vote
1
Answered by
hiccup111 231 Moderation Voter
10 years ago

First of all, this would be much easier to do in a LocalScript, then you can get your Player easier:

--LocalScript
player = game.Players.LocalPlayer

In ROBLOX, you have to make your own Leaderstats.

--ServerScript, put in ServerScriptService

game.Players.PlayerAdded:connect(function(plr)

    Instance.new("IntValue",plr).Name = "leaderstats"
    Instance.new("NumberValue",plr.leaderstats).Name = "Currency"

end)

Once the leaderboard is setup, you can wait for it to load in your LocalScript:

--LocalScript--
player = game.Players.LocalPlayer
leaderstats = player:WaitForChild("leaderstats")

--etc

One last thing, scripts (LocalScripts atleast) don't work so well within Guis. Then tend to load before the Guis load.

I'd suggest putting them at the route (ScreenGui).

0
I know that I have to make the leaderstats myself, done that. So your main points are: 1. Use LocalPlayer (LocalScript) instead of my junk. 2. Use LocalScripts in Gui's. Question: Can I use :FindFirstChild to search for the leaderstats since they are already loaded by the time the Gui opens? fahmisack123 385 — 10y
0
I wasn't critising you, it's just some don't know. Anyway yeah use a FindFirstChild if you like, whatever works for you. hiccup111 231 — 10y
0
Ok, thanks. Eerm, Can I have your ROBLOX username, so I can credit you if you want? fahmisack123 385 — 10y
0
My account is one and the same. But that's not necessary, thanks anyway. A thumbs up would be nice though? =D hiccup111 231 — 10y
Ad
Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

That should do it, did you test it?

Answer this question