Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

i have a problem with attemp to campare bolean >= 30, can anyone help?

Asked by 2 years ago
local db = false


game.Workspace.jorgehit.ClickDetector.MouseClick:Connect(function(player)
    if not db then
        db = true
        script.Parent.Enabled = true
        local function typer(textlabel,text)
            for i = 1,#text do
                textlabel.Text = string.sub(text,1,i)
                script.Parent.lol:Play()
                wait(0.08)
            end
        end
        player.Character.Humanoid.WalkSpeed = 0
        script.Parent.Nombre.Text = "?"
        typer(script.Parent.TextLabel,"Que pasa?")
        wait(3)
        script.Parent.Nombre.Text = "TU"
        typer(script.Parent.TextLabel,"Porque estas tan escondido?")
        wait(1)
        script.Parent.Nombre.Text = "?"
        typer(script.Parent.TextLabel,"Asi me veo cool")
        wait(1)
        script.Parent.Nombre.Text = "?"
        typer(script.Parent.TextLabel,"Eso creo, Bueno eso no importa")
        script.Parent.Nombre.Text = "?"
        typer(script.Parent.TextLabel,"Te vendere algo por solo 30 Bobux")
        wait(0.5)
        script.Parent.Nombre.Text = "TU"
        typer(script.Parent.TextLabel,"...")
        script.Parent.TextButton.Visible = true
        script.Parent.No.Visible = true
        script.Parent.TextButton.MouseButton1Down:Connect(function()
            if  script.Parent.Parent.Parent.dinero.dinero.cantidad == script.Parent.Parent.Parent.dinero.dinero.cantidad <= 30 then
            else if script.Parent.Parent.Parent.dinero.dinero.cantidad == script.Parent.Parent.Parent.dinero.dinero.cantidad >= 30 then
                    script.Parent.TextButton.Visible = false
                    script.Parent.No.Visible = false
                    typer(script.Parent.TextLabel,"Bye")
                    script.Parent.Parent.GUI.Enabled = false

                end
                script.Parent.No.Visible = false
                script.Parent.TextButton.Visible = false
                script.Parent.Nombre.Text = "?"
                typer(script.Parent.TextLabel,"Good")
                wait(1)
                script.Tool.Parent = script.Parent.Parent.Parent.Parent:WaitForChild("Backpack")
                wait(2)
                script.Parent.Parent.GUI:Destroy()
            end
        end)
    end
end)


here is the script dinero = money nombre = name

1 answer

Log in to vote
1
Answered by 2 years ago

Hey there!

I think your problem is in lines 35 and 36 of this code. This is what you have:

  if  script.Parent.Parent.Parent.dinero.dinero.cantidad == script.Parent.Parent.Parent.dinero.dinero.cantidad <= 30 then

            else if script.Parent.Parent.Parent.dinero.dinero.cantidad == script.Parent.Parent.Parent.dinero.dinero.cantidad >= 30 then

First of all, you should probably add some code after line 35, to tell the script what to do if the value is equal to or less than 30.

In this case, you don't need the second "if script.Parent.Parent.Parent.dinero.dinero.cantidad == script.Parent.Parent.Parent.dinero.dinero.cantidad >= 30 then". You can just change this to "else"

Finally, you don't need to have script.Parent.Parent.Parent.dinero.dinero.cantidad listed twice in an if statement. You can just change it to one.

  if  script.Parent.Parent.Parent.dinero.dinero.cantidad <= 30 then
--Your code here for if it is less than or equal to 30
  else
--Your code here for if it is greater than 30
end

I hope this helps! Let me know if you have any questions. Kudos to trying to learn how to script in English :)

Ad

Answer this question