Players.Jackwithgamingyt.Playergui.ScreenGui.LocalScript:93 尝试使用 'Name' 索引

我想使用 Plr.name ,但是出现了 Players.Jackwithgamingyt.Playergui.ScreenGui.LocalScript:93 attempt to index with 'Name' 错误。

有谁能帮忙吗?

local Frame = script.Parent.Frame
local Text = script.Parent.Frame.TextLabel
Text.Text = "Let's Start" .. plr.Name .. " "

我是不是漏了什么东西?

原文链接 https://stackoverflow.com/questions/69412903

点赞
stackoverflow用户2860267
stackoverflow用户2860267

根据你提供的代码示例,看起来plr未被定义。由于你正在使用LocalScript,你可以使用Players服务的LocalPlayer属性来获取当前玩家。

local Text = script.Parent.Frame.TextLabel
local plr = game.Players.LocalPlayer
Text.Text = "Lets Start" .. plr.Name .." "
2021-10-02 01:58:39