Sebwazhere
Sebwazhere

Reputation: 13

A false BoolValue is not equal to false

I'm making a script where when the player joins the game, it shows the credits and then fades out, the animation works, but the BoolValue doesn't.

I have a script which creates a Values Folder:

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

And another one which does the animation if the BoolValue is 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

I put print(SeenIntro.Value) after local SeenIntro = ValuesF:FindFirstChild("SeenIntro") and it prints false, but I put print("Fade Out") after if SeenIntro == false then and it never printed, the animation also didn't play.

Upvotes: 0

Views: 87

Answers (1)

Kylaaa
Kylaaa

Reputation: 7188

A BoolValue is an object, not the value it's holding.

You need to check the value of BoolValue :

if SeenIntro.Value == false then

Upvotes: 1

Related Questions