【发布时间】:2020-05-04 06:08:04
【问题描述】:
在我正在制作的游戏中,有一个销售区域,这就是脚本。我设置了一系列打印语句来查看错误发生在哪里,并且在检查Clouds.Value时发生,您能帮我修复脚本吗,我不知道导致错误的原因。
local Players = game:GetService("Players")
script.Parent.Touched:Connect(function(hit)
print(hit.Name)
if game.Players:FindFirstChild(hit.Parent.Name) then
print("Found")
local plr = Players:GetPlayerFromCharacter(hit.Parent)
local stats = plr:FindFirstChild("leaderstats")
if stats then
print("Working")
local Cash = stats:FindFirstChild("CloudCoins")
print("Cash")
local Clouds = stats:FindFirstChild("Clouds")
print("Clouds")
if Clouds.Value > 0 then
print("Value")
Cash.Value = Cash.Value + Clouds.Value
Clouds.Value = 0
else
print("Error")
end
end
end
end)
【问题讨论】: