[Solved]Simple math example to prevent bots join not working

  1. I wanna achieve simple math example to prevent bots join game

  2. Issue is, each time when i’m writing right answer in text box i’m still being kicked, idk why. Here is screenshots: image image

  3. I tried to change numbers, but i’m still being kicked. I tryed to find anything on youtube/dev hub, but nothing was found.

Here is script:

local x = 1
local y = 1
local z = x + y
local Player = game.Players.LocalPlayer
script.Parent.FirstNumber.Text = x
script.Parent.SecondNumber.Text = y
script.Parent.Frame.TextButton.MouseButton1Click:Connect(function()
	if script.Parent.TextBox.Text == z then
		script.Parent.Parent.Parent.Enabled = false
	else
	Player:Kick("Wrong, try again")
	end
	
end)

I’m beginner scripter, so sorry if this very simple error.

You have to convert it to a number to compare it with another number

if tonumber(script.Parent.TextBox.Text) == z then

Thank you very much! Lemme test

1 Like

Yes it works, thank you very much!

1 Like