“Players.shaz:WaitForChild(“Values”)”上可能有无限的产量我试图做到这一点,以便当玩家认领摊位时,它会将 bool 值变为 true
local claim = script.Parent.Parent.Parent.Parent.StandMesh.Claim
这将触发代理提示。
claim.Triggered:Connect(function(player)
local screengui = player.PlayerGui:WaitForChild('Popups')
local popup = player.PlayerGui:WaitForChild('Popups').ClaimedBooth
local bool = player:WaitForChild('Values').Claimed
local claim = script.Parent.Parent.Parent.Parent.StandMesh.Claim
This will trigger the Proximty Prompt.
claim.Triggered:Connect(function(player)
local screengui = player.PlayerGui:WaitForChild('Popups')
local popup = player.PlayerGui:WaitForChild('Popups').ClaimedBooth
local bool = player:WaitForChild('Values').Claimed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“无限收益可能”是一个警告。它让您知道您的代码不安全,并且在执行此代码时,
value
对象不存在(或不正确地拼写)超过5秒('values')无法解析到对象。实例:waitforchild()要说:
您可以通过添加
timeout
作为第二个参数来删除此警告,但是您需要考虑以下事实:对象可能是对象' t找到:或者,如果您知道
value
将在该代码执行时存在,则可以使用点运算符或findfirstchild()
函数访问它。 。但是,如果value
不存在,这将引发“尝试索引无”错误。当您看到此警告时,应仔细检查对象名称的拼写,以及脚本执行何时执行的时间,以确保对象实际存在。
"Infinite yield possible" is a warning. It lets you know that your code is unsafe, and that when this code executed, the
Values
object didn't exist (or was spelled incorrectly) for more than 5 seconds, andplayer:WaitForChild('Values')
could not resolve to an object.The documentation for Instance:WaitForChild() has this to say :
You can remove this warning by adding a
timeout
as a second argument, but you'll need to account for the fact that it's possible that the object isn't found :Alternatively, if you know that
Values
will exist at the time this code will execute, you can simply access it with the dot operator or with theFindFirstChild()
function. But this will throw an "Attempt to index nil" error ifValues
doesn't exist.When you see this warning, you should double check the spelling on the name of the object, as well as the timing of when the script executes to make sure that the object actually exists.