Hey. I'm trying to make script for highlight the selected enemy but there is a really big problem i couldn't solve. First let me explain my goal. I want to place a circle under selected enemy and place arrow top of selected enemy's head. It should change location when new enemy selected and follow enemy's location. I'm cloning circle and arrow models from ReplicatedStorage to CurrentCamera with local script placed under StarterPlayerScripts. I need a loop for syncing circle's and arrow's position with enemy's position but i should change enemy position too when new enemy selected. I put global variable '_G.SelectedEnemyPos' and while loop that constantly change circle's position to that global variables position. But i can't access this global variable from the script placed under enemy. I have to access it because i have to change circle's trancparency to 1 when enemy is dead. Someone can kill that enemy too. Maybe someone can give me a new perspective. I'm really stuck i can't even think about it. I don't have any other solution. I'm not new at programming but i'm new at gaming there is a client and server they can't use same global variable. If you have a easier solution or new idea please share it to me. THANKS!
COMMUNITY QUESTION
Global Variable Problem ?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Oh my god, why can't you put a tl;dr or explain the problem directly instead of talking about circles? You could literally reword it to something like: "i set _G.SelectedEnemyPos" in this script , but when I try to access it from this script it doesnt work: "
I explained the whole situation because my method will be really bad. I'm open for all solutions or new way to solve it. Sorry for bother you.