Server to Client
Scripts
Scripts
ServerScriptService
ServerScriptService
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
local function onPlayerAdded(player)
remoteEvent:FireClient(player, player.Name)
end
Players.PlayerAdded:Connect(onPlayerAdded)
LocalScript under TextLabel
LocalScript under TextLabel
local label = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
local function onNotifyPlayer(name)
label.Text = 'Welcome ' .. name
wait(5)
label.Visible = false
end
remoteEvent.OnClientEvent:Connect(onNotifyPlayer)