我在roblox中占有一席之地。然后我写了脚本,看一下,请说出问题了吗??? 在另一个脚本中,所有功能都完美运行!,您可以帮我吗?
local players = game.Players:GetChildren()
local pupil = players[math.random(0,#players)]
local James = game.Workspace.James
local Texte = game.StarterGui.ScreenGui.Maintexzt
local nameq = game.StarterGui.ScreenGui.Maintexzt.Nameq
function ontouch(hit)
if hit.Parent:findFirstChild("Humanoid") then
print("Trigget working!")
James.Humanoid.Torso.CFrame = game.Workspace.OutOfhere.CFrame
script.Parent.CFrame = game.Workspace.SpawnLocation.CFrame
end
end
script.Parent.Touched:Connect(ontouch)
function ontouchexit()
Texte.Text = "Uh... We did it??"
wait(2)
nameq.Text = players.Name
Texte.Text = "Oh how we make it?"
wait(2)
nameq.Text = James.Name
Texte.Text = "Better, go home!"
wait(3)
nameq.Text = players.Name
Texte.Text = "Go!"
nameq.Text = James.Name
Texte.Text = "But go to my home!"
nameq.Text = players.Name
Texte.Text = "Nope"
nameq.Text = James.Name
Texte.Text = "Your choice, Your die, You can follow me, or not"
end
script.Parent.TouchEnded:Connect(ontouchexit)
然后请说出问题所在,我想完成一个开发地点。
答案 0 :(得分:0)
local players = game.Players:GetChildren()
https://developer.roblox.com/en-us/api-reference/function/Instance/GetChildren
返回一个数组(一个数字索引表),其中包含所有 实例的直系子孙
nameq.Text = players.Name
不是Robolox专家,我发现players.Name
除了nil
之外什么都不是
您的代码还建议将vlaues分配给这些Text属性将调用某些函数。那会向我解释错误信息。
我不认为有很多玩家会说"Uh... We did it??"
,所以我想解决您的问题的办法是找出您真正想与谁交谈并使用该名字的人。
打印players.Name
并亲自查看。