我正在制作一个脚本,当玩家加入游戏时,它显示演职人员,然后淡出,动画工作,但BoolValue没有。
我有一个脚本创建一个值文件夹:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local ValuesF = Instance.new("Folder")
ValuesF.Name = "Values"
ValuesF.Parent = player
local SeenIntro = Instance.new("BoolValue")
SeenIntro.Name = "SeenIntro"
SeenIntro.Parent = ValuesF
SeenIntro.Value = false
另一个在BoolValue为false时执行动画
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local ValuesF = player:FindFirstChild("Values")
local SeenIntro = ValuesF:FindFirstChild("SeenIntro")
if SeenIntro == false then
-- The animation code which doesn't use the bool is here
SeenIntro.Value = true
end
我把print(SeenIntro.Value)
放在local SeenIntro = ValuesF:FindFirstChild("SeenIntro")
后面打印错误,但是我把print("Fade Out")
放在if SeenIntro == false then
之后,它没有打印,动画也没有播放。
BoolValue是一个对象,而不是它所保存的值。
您需要检查BoolValue:
的值if SeenIntro.Value == false then