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!
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