Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Roblox is saying that a bool value is false while it's true! How do I fix this???

So I'm tryng to make a quest system, but when I got to a part which compares a bool value; the script keeps saying that it's false, while in reality, it's true. I was wondering if this is a bug or if there's an error in my script.

Here is the script:

local YBDavid = game.Workspace:WaitForChild("Young Boy David")

local T1 = script.Parent.Parent.Parent:FindFirstChild("Text1")
local T2 = script.Parent.Parent.Parent:FindFirstChild("Text2")

local Tv = game.ReplicatedStorage:FindFirstChild("Tv")
local Bv = game.ReplicatedStorage:FindFirstChild("Bv")

local QFolder = YBDavid:WaitForChild("Quests")
local A = QFolder:WaitForChild("Accepted")
local B = QFolder:WaitForChild("Beaten")

script.Parent.MouseClick:Connect(function()
	
	
	print("Clicked")
	print(A.Value)
	if A.Value == true then

		print("A = t")
		B.Value = true
		
		Bv.Value = T2
	end
	
	if A.Value == false then

		print("A = f")
		Tv.Value = script.Parent.Parent.Parent.Name..":"
		Bv.Value = T1.Value
	end
end)

Thank you for your time. --CaptainGalexyCreeper

1 comment

0

If the script says its false, then it is false. Problem is not in the script. Try setting the value manually in studio, by changing it in the property window. Note: if you change the A Value to true in the LocalScript, the server will not record it due to client/server filtering. You need to change this value on server.

1 answer

✓ Accepted answer
local YBDavid = game.Workspace:WaitForChild("Young Boy David")

local T1 = script.Parent.Parent.Parent:FindFirstChild("Text1")
local T2 = script.Parent.Parent.Parent:FindFirstChild("Text2")

local Tv = game.ReplicatedStorage:FindFirstChild("Tv")
local Bv = game.ReplicatedStorage:FindFirstChild("Bv")

local QFolder = YBDavid:WaitForChild("Quests")
local A = QFolder:WaitForChild("Accepted")
local B = QFolder:WaitForChild("Beaten")

script.Parent.ClickDetector.MouseClick:Connect(function()


    print("Clicked")
    print(A.Value)
    if A.Value == true then

        print("A = t")
        B.Value = true

        Bv.Value = T2
    end

    if A.Value == false then

        print("A = f")
        Tv.Value = script.Parent.Parent.Parent.Name..":"
        Bv.Value = T1.Value
    end
end)

if this is a part. Then add a clickdetector into that part then paste that. I think your error was you did mouseclick before clickdetector. If thats what you are trying to do. If this isnt what you wanted then just tell me. Accept this answer if it worked.

5 comments

0

It still says that the bool is false, even though I did what you said.

0

which line has the error?

0

My problem is the fact that(I think) that whenever the script runs, its sees that its false and stays like that. But, I don't really know.

0

all I know is the fact that whenever I run this script, even though the value is true, it states it's false.

0

I figured it out!

This discussion is preserved as it was. New answers, comments, and votes are closed.