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

Can you help me answer a few questions I've come across the past few months?

Asked by 7 years ago

I've tried to refrain from asking for help for most of the issues or questions I've had. But I'm stumped and your knowledge shall be absorbed unto me.

1. What should I be looking up for the leaderboards that appear on the place's page? You know with player and group rankings. I've tried player and group leaderboards but results tend to get swamped out by in-game leaderboard tutorials/Q&As.

2. How do you store the current player in variable(s) in multiplayer games. I've wrestled with this for about two weeks now with success being very hit or miss.

Ignore any syntax errors as I'm writing this from memory

local player = game.Workspace.LocalPlayer

This would be what I'd expect to grab whichever player you're playing as but it's often been returning a nil value, even with a wait(10)

local plr = game.Players.LocalPlayer
local plr_Char = plr.Character
local plr_Human = plr_Char.Humanoid

This is copied from a custom health bar tutorial and works fine as far as I remember.

One thing I don't understand is what's going on with the second and third variables. Is plr_Char storing the player in the Workspace, and then plr_Human stores the Humanoid inside it? Is "Character" just a general term for the player's assets inside the Workspace, while LocalPlayer looks in game.Players?

3. What is the differences between the player inside the game.Workspace and the one inside game.Players? I guess what I'm wondering is WHY is there even a game.Players, what is the reason for not just dumping the backpack, gui and all the stuff inside there into the game.Workspace player object?

4. Let's say you have a dozen separate scripts in ServerScriptService that manipulate a part in some way. Do all 12 scripts execute at the same time on launch and whichever one executed last is the effects you will see?

Quite a bit different that slamming out PHP websites and I appreciate your help!

0
The Players service's function is to hold the connections of players & their data, while the Character is hooked up to the player; that's essentially #3 in a nutshell. TheeDeathCaster 2368 — 7y

2 answers

Log in to vote
4
Answered by 7 years ago
  1. If I understand the question correctly, you want to use Player Points.

  2. game.Players stores Player objects, which always exist for every single client in the game. A player object has a variable Character, which reffers to a model in workspace. It can be nil. All the parts that the character is made of, and also their humanoid, are stored in that model.

  3. Because the existance of your character is optional. This allows more freedom for the developer. And a player object has to exist, because it's responsible for your connection with the game and holds all the important data from the website (user id, your character's look id and such).

  4. Do not do that! They will all run at the same time, and this may (and will!) cause issues.

Ad
Log in to vote
-1
Answered by 7 years ago
Edited 7 years ago
  1. No Idea
  2. you need to use game.Players.LocalPlayer in a localscript
  3. game.Workspace is the character, while game.Players is, well, the player, oh,and .LocalPlayer doesn't work in Workspace.
  4. They all execute, but the last one there should be the one that actually works if there's multiple scripts modifying the same property on the same part

Answer this question