|
| 30 Dec 2016 11:27 AM |
Inside a Script within ServerScriptService
game.Players.PlayerAdded:connect(function(Player) if string.sub(Player.Name,1,6)=="Guest " then Player:Kick("You must be logged into ROBLOX.com to play this game.") end game.ReplicatedStorage.PlayerJoin:FireClient(Player) end)
Inside a LocalScript within StarterGui
local StarterGui = game:GetService('StarterGui')
game.ReplicatedStorage.PlayerJoin.OnClientEvent:connect(function(Player) StarterGui:SetCore("ChatMakeSystemMessage", { Text = Player.." has joined the server."; Color = Vector3.new(1, 1, 0); Font = Enum.Font.SourceSansBold; FontSize = Enum.FontSize.Size18; }) end)
The Error
11:24:21.372 - Players.Player1.PlayerGui.LocalScript:4: attempt to concatenate local 'Player' (a nil value) 11:24:21.373 - Stack Begin 11:24:21.373 - Script 'Players.Player1.PlayerGui.LocalScript', Line 4 11:24:21.374 - Stack End 11:24:21.471 - Unable to load plugin icon.
|
|
|
| Report Abuse |
|
|
|
| 30 Dec 2016 11:28 AM |
It's against the roblox rules to ban guests.
|
|
|
| Report Abuse |
|
|
|
| 30 Dec 2016 11:29 AM |
Player is an object, you cant manipulate it with strings
Your looking for Player.Name |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2016 11:31 AM |
Sorry, I didn't know that. The game I'm banning them from is an all-chat game with no actual gameplay. Because Guests cannot chat, and they're not allowed to, they serve no purpose in the game and get kicked.
|
|
|
| Report Abuse |
|
|
|
| 30 Dec 2016 11:32 AM |
And I tried "Text = Player.Name.." has joined the server.";" before, the same error occurred.
|
|
|
| Report Abuse |
|
|
|
| 30 Dec 2016 11:32 AM |
Also when using FireClient, First variable is the person that it goes to, it cannot be used in the event. So do:
FireClient(Player,Player)
When picking up on the server with OnClientEvent
use (...) and then local tuple = {...} to get all the arguments passed |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2016 11:34 AM |
game.ReplicatedStorage.PlayerJoin.OnClientEvent:connect(function(...) local tuple = {...} StarterGui:SetCore("ChatMakeSystemMessage", { Text = tuple[1].Name.." has joined the server."; Color = Vector3.new(1, 1, 0); Font = Enum.Font.SourceSansBold; FontSize = Enum.FontSize.Size18; }) end) |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2016 11:36 AM |
Thank you, that seems to have worked.
|
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Dec 2016 11:37 AM |
Here's the game I'm using this for if you are interested. https://www.roblox.com/games/593157988/Chat-The-Game#!/about
|
|
|
| Report Abuse |
|
|