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

Why wont it print "Joined Match!" when i have converted both values to a number?

So i wanna make a script where players can join matches with a code. Here is the script:

script.Parent.MouseButton1Click:Connect(function()

	
	for _,v in pairs(game.Workspace:GetChildren()) do
		if v.ClassName == "Folder" then
			for _,matches in pairs(v:GetChildren()) do
				if matches.ClassName == "Folder" then
					for _,code in pairs(matches:GetChildren())do
						if code.Name== "MatchCode" then
							local number = tostring(script.Parent.Parent.Parent.CodeInput.Text)--CodeInput is the textbox where players put in the code
							local Ncode= tostring(code.Value)
							if number == Ncode then
							
							print("Joined Match!")
								
							else
								
									print("Invalid Code")
							end
						
							
						end
					end
				end
				end
		end
	end
	
	
end)

Whenever i put in the Code input box the same value as the match code, it still prints invalid code. Someone please help!

4 comments

0

Whats the line 9 for?

0

to find the match code string value

0

Can you try to print the numer print(number) and print the Ncode print(Ncode)

0

When i do that number equals nothing???

1 answer

I think its not necessary to use the "ToString" in your script, Just change line 10 to

local CodeInput = script.Parent.Parent.Parent.CodeInput
local number = CodeInput.Text

And change Line 11 to

local Ncode= code.Value

I hope it works! :D

1 comment

0

Still doesn't work...

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