【发布时间】:2018-08-19 10:05:02
【问题描述】:
Workspace.Part.Script:16:尝试索引本地“screengui”(零值)
wait(2) -- Testing to make sure assets loaded
script.Parent.Touched:connect(function(hit)
if not hit or not hit.Parent then return end
local human = hit.Parent:findFirstChild("Humanoid")
if human and human:IsA("Humanoid") then
local person = game.Players:GetPlayerFromCharacter(human.parent)
if not person then return end
person.Checklist.FirstEggCollected.Value = true
local playgui = person:FindFirstChild('PlayerGui')
print(playgui)
wait(0.2)
local screengui = playgui:FindFirstChild('ScreenGui')
wait(0.2)
print(screengui) -- This prints nil
local collectnotice = screengui:FindFirstChild('CollectionNotice') -- This is line 16
local Toggle = collectnotice.Toggle
local text = Toggle.Text
local value = text.Value
value = "The Easy Egg!"
person:WaitForChild('PlayerGui'):FindFirstChild('ScreenGui'):FindFirstChild('CollectionNotice').Toggle.Color.Value = Color3.fromRGB(0,255,0)
person:WaitForChild('PlayerGui'):FindFirstChild('ScreenGui'):FindFirstChild('CollectionNotice').Toggle.Value = true
script.Parent:Destroy()
wait(5)
game.Workspace.Variables.IfFirstEggInGame.Value = false
end
end)
我已经在这里呆了好几个小时了。不知道如何修复错误。 FE 开启,是的,它的名字是“ScreenGui”,它在“PlayerGui”里面
错误:Workspace.Part.Script:16:尝试索引本地“screengui”(零值)
【问题讨论】:
-
哦,顺便说一句,它在 Studio 中完美运行,但在游戏中却不行。