#Heat source system

1 messages · Page 1 of 1 (latest)

main night
#

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.

serene ridge
#

wdym doesn’t detect for both players

#

how would it it’s a client script only checking one playee

main night
#

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

serene ridge
#

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

main night
#

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?

signal grove
#

I’m no pro but

#

Could you be more specific on what exactly isn’t working

serene ridge
#

my apologies i was soldering something

signal grove
#

Hi again

main night
#

ALL GOOD I WAS TRYING MY BEST TO DEBUG LEMMIE JUST CHECK IF I FIXED IT AND IF NOT ILL REVERT IT

main night
#

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

signal grove
#

That’s so strange

main night
#

HOLY FLAP JACKS I FIGURED IT OUT

signal grove
#

I feel like something isn’t being replicated

signal grove
#

Enlighten me

main night
#

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”

signal grove
#

Ohhh

main night
#

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???

signal grove
#

Still strange distance doesn’t load for the second player

main night
#

YEAH THATS WHAT IM SAYINNN

#

but hey if it works it works

signal grove
#

If distance is updated every frame

#

That makes it make even less sense

#

You’d think it’d update some day

main night
#

yeah I honestly don’t get why it didn’t but LEMMIE see if I can record how it looks now

signal grove
#

Okay

#

Any updates

main night
#

GRAHHHH RECORDING IS A NIGHTMARE

#

BUT I THINK I FIGURED IT OUT

#

UHHHHHHHHH NOW TO FIGURE OUT HOW TO SEND IT...

signal grove
#

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

signal grove
#

Yipeeeeee

#

You did it

#

5 big booms

main night
#

YUS ME AO HAPPY I CAN FINALLY START DOING OTHER RATUFFS

#

STUFFA

signal grove
#

I’m sad because of a Roblox limitation I have to make a new game

#

I was working on it with my friend

main night
#

mhm mhm? wym by limitations?

signal grove
#

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

main night
#

AND U SAY UR NOT A PRO WHAT THE HECK I CANT EVEN IMAGINE PHYSICS WORKIN IN MY GAME YET

signal grove
#

Without like any input from the dev

main night
signal grove
#

This is just broken because I switch network ownership a bunch

signal grove
main night
signal grove
#

Neither did I really until now

#

I’ll teach you

main night
#

HUH SPILL THE BEANS

#

PASSETH THY KNOWLEDGE DOWN TO ME

signal grove
#

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

main night
#

WAAAAAAAAAAAA CONFUSING BUT SO STUFF HAPPENS ON THE CLIENT AND THEN IT IS UPDATED ON THE SERVER AS WELL AND OTHER CLIENTS?

signal grove
#

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

wild sageBOT
#

studio** You are now Level 4! **studio

signal grove
#

Which is what I used

main night
signal grove
#

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

main night
#

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

signal grove
#

Seems cool

#

I’m interested

#

I need to brainstorm a new game idea overnight

#

Maybe it’ll come to me in a dream

main night
main night
#

it's always important to know your limitations doe that's what rlly trips me up

signal grove
#

Then maybe I can reverse engineer it

#

If explaining is too hard

main night
#

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"

signal grove
signal grove
#

I have like 10 rotting in my experiences

signal grove
#

Although at a certain point you just think in studio lmao

main night
#
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

signal grove
#

Ok so

#

What is _

main night
#
for i = 1, 5, 1 do
    print(i)
    i = i + 1
end
main night
signal grove
#

So _ is the index? Can the be replaced by anything else

#

Or is parts the index

main night
#

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

main night
#

that is what is currently being passed in the loop

#

or wait no

signal grove
main night
#

value is the value total value of the whole list/ the end point

main night
#

yk the difference between arrays and dictionaries?

signal grove
#

Uhhh

#

Dictionaries have an entry and then assign things to them right? Like in a table?

main night
#

YUH

#

they have each thing assigned to a number or "index"

signal grove
#

Ok

main night
#

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

signal grove
#

Okay so lemme try something

main night
#

Arrays are different becuase they dont opperate with indexes think of them as more general

main night
signal grove
#

Ok uhhh

main night
#

"i" is most simply defined as the "control variable" the next value is the "End value" and the next is the "increment value

signal grove
#

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

main night
#

the code loops i = i + 1 five times for everyone increment of one passed

signal grove
signal grove
#

Is that times it like does the loop?

main night
#

I ALSO SHOWED ARRAYS

#

I MEAN WAIT THEY SWITCHED HOLD UP

signal grove
#

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

main night
main night
signal grove
#

My brain is melting

main night
#

IT WOULD BE EASIER TO SHOW IN ROBLOX STUDIO I THINk

signal grove
#

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

#

?

main night
#

YUH IM PRTTY SURE U HIT IT RIGHT ON THE SPOT

signal grove
#

Wowie

#

So you can’t append values to things in arrays correct?

wild sageBOT
#

studio** You are now Level 5! **studio

main night
#

ITS ALWAYS GOOD TO LIKE READ THE OFFICAL DEFS ON THE CREATOR HUB AND STUFF DOE

signal grove
#

Yeah I need to lock in and read devforum stuff

signal grove
#

Idk if that’s the right word

main night
main night
signal grove
#

Basically I mean assign a value to things in the array right

#

You can’t do that

#

Right

#

Or wrong

#

Gulp

main night
#

GULP UHM....

#

IMA CHECK...

signal grove
#

Btw we can move to DMs if you want lmao

#

Ty for ur knowledge btw

main night
#

SURE I THINK WE SHOULD RESTART TOO I GOTTA REEXPLAIN MYSELF

signal grove
#

We can exchange knowledge even though you probably know more than me lmao

main night
signal grove
#

You already do lol

lofty thicket
#

Since sometimes a function or two doesnt work during testing, especially when its related to client and it's kindof dumb.

signal grove
#

They fixed it