【问题标题】:Return is getting ignored返回被忽略
【发布时间】:2021-01-13 09:33:30
【问题描述】:

因为我想编写一个脚本让 RemoteEvent 只触发特定组中的用户,我遇到了一个错误

即使我不在组中,即使不允许,它仍然会继续触发服务器 所以“else”被忽略了

if player:IsInGroup(7503826) or (7467047) then
       print("InGroup")
    else
       warn("Not in Intelligence Agency, Either in Internal Security Department")
       return 
end

我做了一个 pcall 函数来检查它是成功还是失败

local success, message = pcall(player, PlayerToBlind)
if success then
print("Success")
else
print("Failed")
end

它总是打印我“失败”

有什么办法吗?

【问题讨论】:

    标签: roblox


    【解决方案1】:

    您的条件将始终返回 true。应该是

    if player:IsInGroup(7503826) or player:IsInGroup(7467047) then
    

    (7467047) 单独作为表达式将始终为真。

    【讨论】:

      猜你喜欢
      • 2021-10-03
      • 1970-01-01
      • 2020-03-23
      • 1970-01-01
      • 2021-01-31
      • 2014-09-03
      • 2020-11-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多