Boolean = true help

For some reason the value does not turn to true but it does print and I checked its postion so it is in the right place.

	if  axes.Normalaxe.Value == true then
		script.Parent.Parent.Parent.Axe.Buy.BackgroundColor3 =  Color3.fromRGB(0, 221, 255)
		script.Parent.Parent.Parent.Axe.Buy.UIStroke.Color = Color3.fromRGB(0, 169, 221)
		script.Parent.Parent.Parent.Axe.Buy.Text = "EQUIP"
		script.Parent.Parent.Equiped.Value = false
	end

line 5

1 Like

All I see is you set it to false not true. what’s the issue here?

1 Like
	if axetype.Value == true then
		if script.Parent.Parent.Equiped.Value == false then
			script.Parent.Parent:WaitForChild("Equiped").Value = true
			script.Parent.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
			script.Parent.UIStroke.Color = Color3.fromRGB(221, 0, 0)
			script.Parent.Text = "UNEQUIP"
			print("Baj")
			unequipall()
			ClearTools()
			GiveTool()

line 3

1 Like

Sorry but I’m a bit confused what’s the script for what are you trying to achieve

1 Like

ok so when the player clicks a button that happens but it works in other scripts and just in this script it does not and equiped is there

1 Like

And I assume this axetype.Value isn’t true?

1 Like

yes that is right, i checked when i was in game

1 Like

Lastly, is the issue about it being false but still printing “Baj” or is the given code not working at all?

1 Like

yeah that is the issue it is still false but printing baj

1 Like

Might be a race condition, Can you send which lines of code switches axetype.Value to true?

1 Like

it is already set to true?

	if axetype.Value == true then
1 Like

Oh, so the problem is this line, not the axetpye.value == true line got it
but I’m not sure if I can help i can’t understand this problem hope you find some help!

1 Like

here is the whike script btw

script.Parent.MouseButton1Click:Connect(function()
	if axetype.Value == true then
		if script.Parent.Parent.Equiped.Value == false then
			script.Parent.Parent:WaitForChild("Equiped").Value = true
			script.Parent.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
			script.Parent.UIStroke.Color = Color3.fromRGB(221, 0, 0)
			script.Parent.Text = "UNEQUIP"
			print("Baj")
			unequipall()
			ClearTools()
			GiveTool()
		else
			if script.Parent.Parent.Equiped.Value == true then
				script.Parent.Parent.Equiped.Value = false
				script.Parent.BackgroundColor3 = Color3.fromRGB(0, 221, 255)
				script.Parent.UIStroke.Color = Color3.fromRGB(0, 169, 221)
				script.Parent.Text = "EQUIP"
				ClearTools()
			end
		end
	else
		if script.Parent.Parent.Amount.Value <= player.leaderstats.Cash.Value then
			game.ReplicatedStorage.Equip.Diamondaxe:FireServer()
			ClearTools()
			GiveTool()
			script.Parent.Parent.Equiped.Value = true

		else 
			return
		end
	end
end)
1 Like

it is not the problem btw
kjgyhjghjgh

1 Like

Thank you for the code but what’s the problem with it what’s the expected behavior and the outcome you’re having

1 Like

ok the problem is that it does not turn true, and I want it to trurn true but it does not turn true and stays false

1 Like

Ok there is a race condition the mouse button may be triggered more than once can you add a print right after the :Connect line and send the output after 1 mouse press\

1 Like

And which value doesnt turn true? Be more specific

1 Like

I belive this line is the issue

1 Like

thats the thing idk whats happening I used this code in other scripts but it just does not turn true even though I make it true and it prints the thing i need to be printe

1 Like