#Joining message
1 messages · Page 1 of 1 (latest)
Players.LocalPlayer
Still not working
show the code
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local function PlayerAdded(player)
local playerName = player.Name
local message = playerName .. " has joined the game!"
TextChatService:DisplaySystemMessage(message)
end
Players.LocalPlayer:Connect(PlayerAdded)```
no localplayer isnt an event
a
u can do
player = Players.LocalPlayer
to get the name of the player
u dont need any functions
the code in local script will run when player joins anyway
like this ?
and I replace the LocalPlayer by player ?
add local before the player
no u dont need to replace anything
why would he do that
local scripts run when the player running the script is added u dont need any events
I am new to scripting so I wont be able to understand everything
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local player = Players.LocalPlayer
local message = player.Name.." has joined the game!"
TextChatService:DesplaySystemMessage(message)
yes but
why are u using Connect
I did this but its still not working
I don't need ?
huh
how local scripts work is that every player runs their own local script
and they start running when the player joins the game
u can use the Players.LocalPlayer to get the player that is running the script