Teleporter only tp one player

I want to make a script where a chat message is sent when a player touchs a part but that message contains the player’s name with some text

this is what i have but i need to replace “Someone” with the player name

game.StarterGui:SetCore( "ChatMakeSystemMessage",  { Text = "Someone found an exit", Color = Color3.fromRGB(62, 210, 255), Font = Enum.Font.Highway, FontSize = Enum.FontSize.Size32 } )

You can concatenate, or join, a string with a separate value, as long as it is also a string.

In your script, it would look like this:

game.StarterGui:SetCore( "ChatMakeSystemMessage",  { Text = player.Name .. " found an exit", Color = Color3.fromRGB(62, 210, 255), Font = Enum.Font.Highway, FontSize = Enum.FontSize.Size32 } )

replace player.Name with whatever place you have the player’s name in your script.

1 Like

Server script:

local Exit = workspace.Exit

local ChatMessageRemote = game.ReplicatedStorage.ChatMessageRemote

Exit.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		ChatMessageRemote:FireAllClients(player)
	end
end)

Local script:

local ChatMessageRemote = game.ReplicatedStorage.ChatMessageRemote

ChatMessageRemote.OnClientEvent:Connect(function(player)
	game.StarterGui:SetCore( "ChatMakeSystemMessage", {
		Text = player.Name .. " found an exit",
		Color = Color3.fromRGB(62, 210, 255),
	})
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.