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

"If" statement not reading?

Im making a gui button that when i click on it, it puts my character in a certain team but if the team is full it will make the button blink and say its already filled, the thing is, when the said team is full, its not doing anything (not even printing the "wut" part). joining the team works and if its full it wont try to add more players than it should.

function OnClicked()
	local w = script.Parent.Parent:WaitForChild("Main")
	local _Main = require(script.Parent.Parent.Main)
	local actual = script.Parent.Parent.Actual
	local amount = game.ReplicatedStorage.Role:FindFirstChild(script.Parent.Name)
	local color = script.Parent.BackgroundColor3
	if actual.Value ~= script.Parent.Name then
		if amount.Amount.Value >= amount.Max.Value then --its like this part doesnt exists
			print("wut?")
			script.Parent.Text = "Already Filled!"
			for i= 1,3 do
				script.Parent.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
				wait(.2)
				script.Parent.BackgroundColor3 = Color3.fromRGB(color)
				wait(.2)
			end
			script.Parent.Text = script.Parent.Name
			else                                            -- but from here it works
			actual.Value = script.Parent.Name
			amount.Amount.Value = amount.Amount.Value+1
			_Main.Play()
		end
	end
end


script.Parent.MouseButton1Click:Connect(OnClicked)

4 comments

0

Amount.Value is less than max value?

0

well it doesnt print it

1

ur script is rly confusing u should try arranging it maybe ull find the problem like that

1

it doesn't print anything after else so yeah

1 answer

function OnClicked()
    local w = script.Parent.Parent:WaitForChild("Main")
    local _Main = require(script.Parent.Parent.Main)
    local actual = script.Parent.Parent.Actual
    local amount = game.ReplicatedStorage.Role:FindFirstChild(script.Parent.Name)
    local color = script.Parent.BackgroundColor3
    if not actual.Value == script.Parent.Name then
        if amount.Amount.Value >= amount.Max.Value then --its like this part doesnt exists
            print("wut?")
            script.Parent.Text = "Already Filled!"
            for i= 1,3 do
                script.Parent.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
                wait(.2)
                script.Parent.BackgroundColor3 = Color3.fromRGB(color)
                wait(.2)
            end
            script.Parent.Text = script.Parent.Name
            else                                            -- but from here it works
            actual.Value = script.Parent.Name
            amount.Amount.Value = amount.Amount.Value+1
            _Main.Play()
        end
    end
end


script.Parent.MouseButton1Click:Connect(OnClicked)

u do ==

1 comment

0

lol

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