Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
DJH_100 28
5 years ago

this is the code i have

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

0
This is in a LocalScript, right? metalive 0 — 5y
0
This should work but for client only karlo_tr10 1233 — 5y
0
it is not one DJH_100 28 — 5y
0
i made it a localScript changed it a little and it worked! :D DJH_100 28 — 5y
0
also, i just started learning Lua and im only 9yo DJH_100 28 — 5y

2 answers

Log in to vote
0
Answered by
l1u2i3 52
5 years ago

I think I got it.

local player = game.Players.LocalPlayer.Name
script.Parent.TextLabel.Text = (player) --- All you needed were the parentheses.
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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

Answer this question