hey guys tsl here back with a brand new video in today's video i will be showing you guys how you can make your very own like friend invite and friend boost system now obviously well not obviously but i'm going to show you how to make it so that you have the boost right but um it doesn't actually do anything because i don't have anything for it to boost in this game as you see i have all the stuff we need and i'm gonna walk you through the steps to do this so the first thing i will do is go into my script this i just have a leader stats basically for a local friend boost that we store inside the player which is a number value that starts at one and i also have this player count which is an in value in replicated storage and every time a player joins we just add one to that count so then in a local script in here in a starter gui i check every time the player count has changed in replicated storage and i fire a remote event in replicated storage called check friend boost so then i have a script in server script service called friend boost script and the first thing we do is obviously check for the server event and we get the player from our on server event we get our local player so all the players in the game we get our players friend boost of variable thingy or number value then we make a friend boost uh value right here and then over here we go we loop through every player in our players and call it plr here we check and make sure that our plr is not equal to our player so like the player we are currently looping through is not us um if it is us then we just continue to the next loop iteration that's what this continue word does or just continue keyword if you've never used it next we make a has friend variable which is equal to playercon is friends with plr dot user id and um the player then we just print the player name is friends with plr. name but what i forgot to do is check if has friend then end and now it will make sure that we have a friend and it will print our name and it will add 0. 25 to the friend boost obviously this can be whatever you want then at the end we set our friend boost value to our friend boost variable so then i have also this invite friends uh thing so let me go ahead and show you guys that so i have this button i press and basically the invite friends thing comes like like in games so basically what i have here is an invite button and we'll get to that in a moment i also have this frame uh basically it's just like a frame that in case something goes wrong i actually haven't had anything go wrong so i actually haven't seen this frame in action yet but anyways this frame uh is at position negative 0.
5 on the y that's why you can't see it but if i bring it down then it says can't can't invite friend and it has a dismiss button so this dismiss button just basically uh makes the uh whole thing just fly back up to its negative position so now inside of our invite button i have a local script with a social service variable a players variable a player variable and a button variable so every time we click the button we use dot activated so it works on mobile and computer so then what we check is if we can invite is equal to social service calling can send game invite async player is the parameter so if we can't invite then we do a social service pull and prompt game invite to a player to the player and elsa if we cannot invite then we just get our players player gui get the invite friends which is the name of the screen gui the can't invite and between its position and this might be why i uh never saw it maybe we did have something go wrong but my frame is just called frame so if i just change this to frame and between the position down to 0. 5 comma 0 comma 0. 1 comma 0 then we will see our frame and that is actually all there is to it other than this little display gui and basically i'll just show you that we check for we get our player first of all and then we get our players friend boost and every time the value and that has changed we change our script about parent.
text equal to friend boost colon space and we concatenate players friend boost value and then x for times obviously so then the last thing i want to do that i haven't added yet is go back into this script and we'll do a game dot players dot player removing clone connect function player to game that replicates store shop player count dot value and this time we want to minus equals one because we want to get rid of a player every time a player leaves and add a player every time a player joins so uh you could just trust me and i'll say it works because it does if you did everything correctly and uh but i'll also show you guys a test but i'll need to do this in a game so i'll go ahead and save this to roblox and publish to roblox okay so here i am i just loaded into the game and i don't have any friends in the game right now so i just have a friend boost of one times so that means it doesn't multiply at all if we open up our invite and i'm going to search for one of my friends i'm going to invite him and let's see if he will come alright so let's send him an invite see us ascending and invited and then we can x out of the frame and i'm gonna wait until he joins okay so my friend just joined the game and as you see now i have a 1. 25 times a friend boost and he should have the same and then watch as he leaves just gotta tell him to leave you can go now all right but anyways as you see we have a friend boost of 1. 25 times and as you saw before we had eight just one times and we had the invite friends thing going for us and then once he leaves it should go back down to one times all right and as you saw he just left and now we have a one times boost once again all right guys well that is it for today's video if you enjoyed this video and it helped you out please remember to leave a like and subscribe and i hope to see you guys in the next one also we are very close to 1.