Boolean = true help

is it th waitforchild becasue i was just doing that to see if it was the issue and its not it should be

			script.Parent.Parent.Equiped.Value = true
2 Likes

Remove the Waitforchild and print the Equipped value

2 Likes

The WaitForChild should not be an issue it would’ve yielded and the code wouldn’t work at all

2 Likes

I tried that and it is false for some reason

2 Likes

Can you please try this

2 Likes

can you please try expaining in more simpler tearms im new to scripting

2 Likes

He means to add a print in the beginning of the function before all the if statements and check if its printing more than once after clicking just one time

2 Likes

kk, I did that and it prints, But something weird happened. it turns true now but it does not turn off??

script.Parent.MouseButton1Click:Connect(function()
	print("ga")
	if axetype.Value == true then
		if script.Parent.Parent.Equiped.Value == false then
			script.Parent.Parent.Equiped.Value = true
			print(script.Parent.Parent.Equiped.Value)
			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)

middle if satament

2 Likes

How many time did it print and also add a task.wait(0.1) line right after that print

2 Likes

only once


2 Likes

also i just checked it is not turning true, but the script is printing true

2 Likes

You can remove the print replace these lines;

		else
			if script.Parent.Parent.Equiped.Value == true then

with

		elseif script.Parent.Parent.Equiped.Value == true then
2 Likes

thanks, but it did not work, and when I pint the value it is true and but is not true when i check

2 Likes

This issue is rage-inducing I have to sleep I’ll be back tmrw

2 Likes

The 3 functions you run inside the if statement, especially the unequipall(), could maybe be interfering with everything? Do they have wait’s in them and do they change any values?

2 Likes

THANKYOU I relised that i tmakes the value so that it makes the value false it worked in otherscripts but thanks for the help a lot!

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.