I'm experimenting with client-side GUI and I'm not completely sure why my code doesn't detect distance for both players when testing the client with 2 players. My code is within the frame I'm using as the "temprature bar" GUI so it isn't a parenting thing I dont think. My code is in the image provided, if any additional information is nessecary please ask and I'll see what I can do.
#Heat source system
1 messages · Page 1 of 1 (latest)
wdym doesn’t detect for both players
how would it it’s a client script only checking one playee
i thought that local player meant that it would check the distance for each player that the script was in yk? Did I misunderstand that?
Like Temp goes down for the other player but not up and for the other it's completely functional
yes; a local script runs for each player as in the script is given to each player
they don’t communicate with one another at all
mhm! so this should in theory work for each individual player shouldn't it? I don't understand why it only works for one player
it might be a bit laggy but would a video help?
Anything I should make more clear?
yo?
yes
my apologies i was soldering something
Hi again
ALL GOOD I WAS TRYING MY BEST TO DEBUG LEMMIE JUST CHECK IF I FIXED IT AND IF NOT ILL REVERT IT
YO MB OKI OKI
SĂ“
THERE ARE HEATSOURCES WHICH ARE PARTS WITHIN A FOLDER CALLED HEATSOURCES. The script is meant to detect the distance between the Local player and those “heatsources” and if they are close they gain “TEMP” which in turn restores their “temperature bar” and visa versa if they stray too far from a heat source. The problem is that this script only works within a single player despite being within a frame which is nested within a ScreenGui which is nested within StarterGui which should make it so the script is given to each player and in turn, applied to each player but TEMP just won’t go up for the second client and I dunno why
It depletes just fine though
But distance isn’t printed for the second client
That’s so strange
HOLY FLAP JACKS I FIGURED IT OUT
I feel like something isn’t being replicated
DISTNACE JUST FOR WHATEVER REASON WASNT BEING LOADED FOR THE SECOND PLAYER SO IF DISTANCE WAS NIL WHICH I WAS DUMB ENOUGH TO NOT CHECK FOR I JUST TRIED FINDING IT USING .Magnitude INSTEAD OF “player:DistanceFromCharacter”
Ohhh
So I kinda made a second backup definition for distance if for whatever reason it didn’t load
but I still don’t get why it didn’t???
Still strange distance doesn’t load for the second player
If distance is updated every frame
That makes it make even less sense
You’d think it’d update some day
yeah I honestly don’t get why it didn’t but LEMMIE see if I can record how it looks now
GRAHHHH RECORDING IS A NIGHTMARE
BUT I THINK I FIGURED IT OUT
UHHHHHHHHH NOW TO FIGURE OUT HOW TO SEND IT...
Too big of a file?
U can use streamable
Lifesaver
Also you know what I bet the reason it doesn’t work for the second player maybe (maybe because it doesn’t make sense that this wouldn’t happen for the first player) you might have forgotten a waitforchild somewhere
I’m sad because of a Roblox limitation I have to make a new game
I was working on it with my friend
mhm mhm? wym by limitations?
Not exactly a roblox limitation but just slow physics communication between server and client that broke the core mechanic
It works until other players join
I made a post about it going more in depth
Nothing would work without compromising the entire vision
AND U SAY UR NOT A PRO WHAT THE HECK I CANT EVEN IMAGINE PHYSICS WORKIN IN MY GAME YET
Physics are mostly all done by Roblox
Without like any input from the dev
that honestly sucks so bad I would have to learn so much to even think about helping WAAAAAAAAAAa
This is just broken because I switch network ownership a bunch
There isn’t a solid solution
gulp... i dont even know what that is...
Basically if you give a player network ownership of something, physics and probably other things are handled on the client of the player who is the network owner of it
It is then replicated to the server
Or what
Sorry
Other clients
You don’t really replicate stuff to the server
Do you?
Idk
So if you are the network owner of say a part, all the physics are calculated on your client
And then replicated to other clients
WAAAAAAAAAAAA CONFUSING BUT SO STUFF HAPPENS ON THE CLIENT AND THEN IT IS UPDATED ON THE SERVER AS WELL AND OTHER CLIENTS?
Yeah pretty much
Basically how stuff works is usually the server does stuff (bada bing bada boom) then replicates it to clients, that’s why wait for child is a thing since things aren’t replicated instantly
Almost everything is handled on the server
That’s why some objects moves laggy sometimes
Since it’s being calculated in the server
This doesn’t mean you should handle most things on the client
Quite the opposite
It’s just useful for certain things
Like ragdolls
Or a drag and drop system
** You are now Level 4! **
Which is what I used
Yussssssssssssssssssssssssssssssssssss client stuff can be confusing sometimes https://tenor.com/hUOmtzQjtI3.gif
Oh yeah fs
We are in this together
I’m slowly learning the inner workings
Yet I still don’t know how a for loop works (how to set one up and use it)
It’s like for i (index) and then some other bs
That I don’t remember and changes a bunch
WAAAAAAAAAa I basically just got wind of the basics of how local scripts work from the coding book I'm reading and I kiiindaaaaa got bored of reading it so I decided to jst follow tutorials and do a basic lil game idea i thought up to test myslef
Seems cool
I’m interested
I need to brainstorm a new game idea overnight
Maybe it’ll come to me in a dream
YUH I JUST LEARNED ALL THAT HONESTLY I WISH I COULD JUST SHOW YOU I USED TO BE CONFUSED ON THAT FOR LOOP STUFF TOO
the best game ideas do
it's always important to know your limitations doe that's what rlly trips me up
Give me just 2 examples, a loop that just goes 5 times and one that looos through the workspace and prints all children
Then maybe I can reverse engineer it
If explaining is too hard
I always try to do the bare minium write ways to improve it for future me and then polish once I'm satisfyied with the "Demo"
I’ve never even gotten close to a finished game
ALRIGHT LEMMIE JUST THINK
I have like 10 rotting in my experiences
If it helps typing it in studio could be more familiar and help you type it faster
Although at a certain point you just think in studio lmao
local partsInWorkspace = workspace:GetDescendants()
for _, parts in pairs(partsInWorkspace) do
print(parts)
end
oki oki oki uhhh so i probs shouldve given the other example first but that's the workspace one
and uhhhh
for i = 1, 5, 1 do
print(i)
i = i + 1
end
oki oki so the first number is the index and the second is the value
how i understand it is that index is the number that the loop is currently on, and since an array isn't looked through by the computer in a specific order it is blank
parts is the value
that is what is currently being passed in the loop
or wait no
So is _ like infinite or something???
value is the value total value of the whole list/ the end point
nah it's more like a way to represent the lack of need for order ig? but that's only for arrays and also why in pairs is used instead of in ipairs
yk the difference between arrays and dictionaries?
Uhhh
Dictionaries have an entry and then assign things to them right? Like in a table?
Ok
if you were to ask the system for a specific index within a table it would give you whatever value, string, ect. was assigned to that value within the table
Okay so lemme try something
Arrays are different becuase they dont opperate with indexes think of them as more general
also i think i should clear up the for loop with a defined index, this one
Ok uhhh
"i" is most simply defined as the "control variable" the next value is the "End value" and the next is the "increment value
Can you give me an example of a dictionary and an array (IM SO SO SORRY I JUST NEED TO SOAK IN THE INFO BEFORE I SLEEP) I remember dictionary was like
Local test = {
Something = {
[Bool] = true
}
}
Or something
Idek
the code loops i = i + 1 five times for everyone increment of one passed
I’ve only used a dictionary like this before to define stuff in room types for a room gen script like weight and such
What’s really throwing me off is the 1 at the end
Is that times it like does the loop?
dictionaries and arrays are like this ```
local array = {"first thing", "second thing", "third thing"}
local dictionary = {
Agatha = 1000,
Billie = 150,
Jim = 1200,
}
I ALSO SHOWED ARRAYS
I MEAN WAIT THEY SWITCHED HOLD UP
Ohhh okay
So did I use an array?
I just remember being able to map more things to one thing
Like I had room 1 and I could map weight and such to it
Jim = 1200 is killing me
nah you used a dictionary bc you used lables which had values instead of indexes acording to my book thingy
STOPPPPP I DIDN'T KNOW WHAT TO PUT
My brain is melting
IT WOULD BE EASIER TO SHOW IN ROBLOX STUDIO I THINk
Wait
Which had value instead of values
What
I think I see what ur getting at?
Array is like
A sequence of names or objects or something idek whereas dictionaries are a table of things with values inside of them
?
YUH IM PRTTY SURE U HIT IT RIGHT ON THE SPOT
** You are now Level 5! **
ITS ALWAYS GOOD TO LIKE READ THE OFFICAL DEFS ON THE CREATOR HUB AND STUFF DOE
Yeah I need to lock in and read devforum stuff
append?
Idk if that’s the right word
The book is basically that stuff but just more digestible and ordered
WAAAAAAA U PROBS DID IM JUST NOT FAMILIAR WITH IT
Basically I mean assign a value to things in the array right
You can’t do that
Right
Or wrong
Gulp
SURE I THINK WE SHOULD RESTART TOO I GOTTA REEXPLAIN MYSELF
We can exchange knowledge even though you probably know more than me lmao
FOR SURE I LOVE SHARING
trust me i dont...
You already do lol
Have you tried playing it Live in a Roblox Client with a friend Rather than Testing?
Since sometimes a function or two doesnt work during testing, especially when its related to client and it's kindof dumb.
They fixed it