Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I want to make a game like camping, but i cant get the text to change to a players name?

this is the code i have

local player = game.Players.LocalPlayer.Name script.Parent.TextLabel.Text = player

5 comments

0

This is in a LocalScript, right?

0

This should work but for client only

0

it is not one

0

i made it a localScript changed it a little and it worked! :D

0

also, i just started learning Lua and im only 9yo

2 answers

✓ Accepted answer

I think I got it.

local player = game.Players.LocalPlayer.Name
script.Parent.TextLabel.Text = (player) --- All you needed were the parentheses.

I got it too! Put this script into ServerScriptStorage but make a remote event Called Dialogue

local dialogue = game.ReplicatedStorage.Dialogue
local type = Enum.ThumbnailType.HeadShot
local size = Enum.ThumbnailSize.Size180x180

function Message(player, speech, id)
	dialogue:FireAllClients(player, speech, id)
end
wait(5)
local players = game.Players:GetChildren()
local player = players[math.random(1, #players)]
local id = game.Players:GetUserThumbnailAsync(player.UserId, type, size)
Message(player, "Example Here", id)

For Local Script

local dialogue = game.ReplicatedStorage.Dialogue
local frame = script.Parent.Frame
local thumbnail = frame.Thumbnail
local text = frame.Dialogue
local player = thumbnail.Player

function Message(speech)
	for i = 1, #speech do
		text.Text = string.sub(speech, 1, i)
		wait()
	end
end

dialogue.OnClientEvent:Connect(function(plr, speech, id)
	player.Text = plr.Name
	thumbnail.Image = id
	Message(speech)
end)

First make an frame With Image Label and put a textlabel name it into Player into the Imagelabel And In the frame Make an Text Label Called Dialogue but not in the image label in the frame

This discussion is preserved as it was. New answers, comments, and votes are closed.