Well, i'm making a game where you collect coins to buy more cars, but I want that, when a guest Joins a game, a GUI (notification appears) and says, that you're a guest and your progress won't be saved, but I only need the script to detect the guest. Thanks! ;)
You would need to check the name and have a GUI ready to make visible if they're a guest. Here is the way I think would work best:
1 | GUI = script:FindFirstChild( "GUI" ) -- Find the GUI |
2 |
3 | if script.Parent.Name:sub( 1 , 6 ) = = "Guest " then -- Check the first 6 letters for a guest's name. |
4 | GUI:Clone().Parent = script.Parent -- Clone the GUI and change the parent to PlayerGui. |
5 | GUI.Frame.Visible = true -- Make the main thing visible. |
6 | end |
You will need to have something like a confirm button to close it or add a timer then remove it. Hope this helps, if it does please leave a vote up, it doesn't hurt to click a button!
in order to detect a guest, do this:
1 | local plr = game.Players.LocalPlayer |
2 | game.Players.PlayerAdded:connect( function (plr) |
3 | if plr.AccountAge = = ( 0 ) then |
4 | -- code here |
5 | end |
6 | end ) |
or, this:
1 | local plr = game.Players.LocalPlayer |
2 | game.Players.PlayerAdded:connect( function (plr) |
3 | if plr.Name:sub( 1 , 6 ) = = "Guest " then |
4 | -- code here |
5 | end |
6 | end ) |
hope this helped!