【发布时间】:2021-10-13 20:15:19
【问题描述】:
当我触摸winpad(将触发上面代码的部分)时,它会一直说错误
ServerScriptService.Pads:342: 尝试比较数字
第 342 行是
if Times < minTime and Timem < 1 and kicks == true and #Boosts == 0 then
这是第 342 行的一些上下文
local BadgeIDValue = Winpad.KitFolder.Value:FindFirstChild("BadgeID")
local BadgeID = 0
if BadgeIDValue then BadgeID = BadgeIDValue.Value end
local TowerNameValue = Winpad.KitFolder.Value:FindFirstChild("ProperName")
local TowerName = "Unknown"
if TowerNameValue then TowerName = TowerNameValue.Value end
local difficulty = Winpad:GetAttribute("Difficulty")
local diffcolor = DifficultyDictionaryColors[difficulty]
local nicelevel = Winpad:GetAttribute("NiceLevel")
local isSC = Winpad:GetAttribute("isSC")
local winroom = Winpad:GetAttribute("Winroom")
local minTime = Winpad:GetAttribute("MinimalTime")
local CPsReq = Winpad:GetAttribute("CPsRequired")
local Time:string,Boosts:table<string>? = GetTimerRemote:InvokeClient(Player)
local checks = ServerStorage:FindFirstChild(Player.Name)
local towerac = v.Name
local Times = tonumber(string.sub(Time, 4, 5))
local Timem = tonumber(string.sub(Time, 1, 2))
local kicks = script.Switches.KicksEnabled.Value
if Times < minTime and Timem < 1 and kicks == true and #Boosts == 0 then
Kick(Player, Time, TowerName, difficulty, Boosts, script.KickReasons.TooEarly.Value) return
end
if checks and CPsFound and kicks == true and #Boosts == 0 then
for i, v in pairs(checks:GetChildren()) do
if checks:FindFirstChild(towerac.."_"..i) then
CPCount = CPCount + 1
end
end
end
【问题讨论】:
-
342 是哪一行?目前我建议打印
Times和Timem看看是否有nil有可能是你的问题之一,或者两者兼而有之。这可能是由于您如何解析Time值。 -
“if Times
-
是的,在那一行之前添加
print(Time, Timem, Times),打印的结果应该告诉你出了什么问题。 -
好吧,那我明天去看看