My script is not working

It was working well, Until i added a bool value to the script, that when is false it activates to true, but this doesnt happens, it just prints the First “Hi”

task.wait(0.1)
local module = {}
local globals = require(workspace.Globals)
local timeStart = tick()
local replicated = game.ReplicatedStorage
local value = workspace:WaitForChild("TextDisplayed")
local tweenService = game:GetService("TweenService")
local tInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)


--local event = replicated:WaitForChild("TextEvent")
local historyfolder = workspace:WaitForChild("HistoryValues")
local valueHistory = workspace:WaitForChild("havekey")
local mesh = script.Parent.Parent:WaitForChild("MeshPart")

local RandomTexts = {
	"There.",
	"So There you was.",
	"Found It.",
	
}

module.OnHover = function(part, distance)
	return {}
end

module.OnHoverEnd = function(part, distance)
	return {}
end

module.OnClick = function(part, distance)
	
	
	--RandomTexts[10] = math.random(1,10000)
	print("Hi")
	if not valueHistory then
	--	print("Hi2")
	--	valueHistory.Value = true
		value.Value = RandomTexts[math.random(1,3)]		--RandomTexts[10]
		--local t = tweenService:Create(mesh, tInfo, {CFrame = CFrame.new(36.318,0,0)})
	--	t:Play()
	end
--event:Fire()
	
	--return {["Disable"]=true}
	
end

return module


Except that in this other script it works with a local variable inside it

local module = {}
local globals = require(workspace.Globals)
local timeStart = tick()
local replicated = game.ReplicatedStorage
local value = workspace:WaitForChild("TextDisplayed")
--local event = replicated:WaitForChild("TextEvent")

local event = script.Parent.Parent:WaitForChild("ChangeText")
local cooldown = false

local RandomTexts = {
	"I Dont Think I Can Enter..",
	"Maybe I Should Find My Keys First?",
	"It Wont Let Me",
	"I Can't Enter",
}

module.OnHover = function(part, distance)
	return {}
end

module.OnHoverEnd = function(part, distance)
	return {}
end

module.OnClick = function(part, distance)
	
	value.Value = RandomTexts[math.random(1,4)]		--RandomTexts[10]
	if not cooldown then
		cooldown = true
		script.Parent.Parent.Door.Lockeds:Play()
		task.wait(1.25)
		cooldown = false
	end
	--RandomTexts[10] = math.random(1,10000)

	
--event:Fire()
	
	--return {["Disable"]=true}
	
end

return module



If you are referencing a bool value in the workspace, you would need to change the line

if not valueHistory then

to

if valueHistory.Value == false then

I did that too and it didnt work

30 chsars