#Mousebuttonclick1 is nil

169 messages · Page 1 of 1 (latest)

fiery sapphire
#

some weird problem is when you order "acid" it's give you milk, and mousebuttonclick1 function value is nil

#

script.Parent.MouseButton1Click:Connect(function(t)
print(t)
if script.Parent.Parent.Ordering.Text == "milk" or "Milk" then
script.Ordered:Play()
script.Parent.Parent.Ordering.Text = ""
game.ReplicatedStorage.SCP.SCP294.Cloning:FireServer("milk")
script.Parent.Parent.Enabled = false
elseif script.Parent.Parent.Ordering.Text == "coffee" or "Coffee" then
script.Ordered:Play()
script.Parent.Parent.Ordering.Text = ""
game.ReplicatedStorage.SCP.SCP294.Cloning:FireServer("coffee")
script.Parent.Parent.Enabled = false
elseif script.Parent.Parent.Ordering.Text == "acid" or "Acid" then
script.Ordered:Play()
script.Parent.Parent.Ordering.Text = ""
game.ReplicatedStorage.SCP.SCP294.Cloning:FireServer("acid")
script.Parent.Parent.Enabled = false
else
script.Error:Play()
script.Parent.Parent.Ordering.Text = ""
script.Parent.Text = "Error"
task.wait(1)
script.Parent.Text = "Order"
end
end)

#

Script

#

as you see

#

nothing shit is wrong

#

but when I type "Acid"

#

it's give you milk

#

wth

fiery sapphire
#

no error btw

#

I got no clue

#

how it not work

#

yeah so weird

#

I check the script.Parent.Parent.Ordering.Text

#

it's say value is "acid"

#

but it's run on

if script.Parent.Parent.Ordering.Text == "milk" or "Milk" then
script.Ordered:Play()
script.Parent.Parent.Ordering.Text = ""
game.ReplicatedStorage.SCP.SCP294.Cloning:FireServer("milk")
script.Parent.Parent.Enabled = false

#

sure sure

#
script.Parent.MouseButton1Click:Connect(function(t)
    print(t)
    if script.Parent.Parent.Ordering.Text == "milk" or "Milk" then
        script.Ordered:Play()
        script.Parent.Parent.Ordering.Text = ""
        game.ReplicatedStorage.SCP.SCP294.Cloning:FireServer("milk")
        script.Parent.Parent.Enabled = false
    elseif script.Parent.Parent.Ordering.Text == "coffee" or "Coffee" then
        script.Ordered:Play()
        script.Parent.Parent.Ordering.Text = ""
        game.ReplicatedStorage.SCP.SCP294.Cloning:FireServer("coffee")
        script.Parent.Parent.Enabled = false
    elseif script.Parent.Parent.Ordering.Text == "acid" or "Acid" then
        script.Ordered:Play()
        script.Parent.Parent.Ordering.Text = ""
        game.ReplicatedStorage.SCP.SCP294.Cloning:FireServer("acid")
        script.Parent.Parent.Enabled = false
    else
        script.Error:Play()
        script.Parent.Parent.Ordering.Text = ""
        script.Parent.Text = "Error"
        task.wait(1)
        script.Parent.Text = "Order"
    end
end)
#
game.ReplicatedStorage.SCP.SCP294.Cloning.OnServerEvent:Connect(function(plr, a)
    local t = game.ServerStorage.Drinks[a]:Clone()
    t.Parent = plr.Backpack
end)
fiery sapphire
#

question is why it readed on first if

#

💀

#

like

#

I type Acid in textbox

#

it's give you milk

proper salmon
#

thats acid but in a milk box :>

fiery sapphire
#

heh

#

so because of bug?

#

so how do I

#

fix it

proper salmon
#

look try checking the text of thee textlabel in the server.

#

instead of checking the client

#

just fire the server

fiery sapphire
#

?

proper salmon
#

let the server check it

fiery sapphire
#

ok I'll try

hushed cypressBOT
#

studio** You are now Level 2! **studio

fiery sapphire
#

if you do like that

#

wait acually

#

no

#

nvm

#

not yet

#

I'm scripting

#

alr let's see

hushed cypressBOT
#

studio** You are now Level 1! **studio

fiery sapphire
#

yeah how

#

BRO WHAT

#

EVEN SERVER BRO

#

IT'S GIVE YOU MILK

#

EVEN I TYPE NOTHING

#

?

#

yes

#

so

#

💀

#

how can I fix it then

#

wait I have idea

#

if textbox lost focus

#

is save data to int value thing

#

and then

#

when you click run the script

#

I mean

#

click the button

#

it send to another value

#

and put changed conditions

#

damn

#

ok

#

I'll try

potent needle
#

what's the issue.

#

i can lend help 🙂

fiery sapphire
#

it's give you milk

fiery sapphire
#

how the hell

#

💀

#

fr

potent needle
#

if the roblox lua system bug is the case

#

hm

fiery sapphire
#

💀

#

thing I should do is like

#

if you click

#

it will clone you a checking script

#

damn

#

that will

potent needle
#

perfect punctuation!

hushed cypressBOT
#

studio** You are now Level 3! **studio

fiery sapphire
#

yeah imagine

#

WAIT

#

WAIT

#

WAIT

#

nvm

potent needle
#

ineed help with my post. 🙂

hushed cypressBOT
#

studio** You are now Level 2! **studio

potent needle
#

gahh

#

its the newest one available

fiery sapphire
#

@proper salmon

script.Parent.FocusLost:Connect(function(a)
    if script.Parent.Text == "Milk" or "milk" then
        script.Parent.Parent.Number.Value = 1
    elseif script.Parent.Text == "Coffee" or "coffee" then
        script.Parent.Parent.Number.Value = 2
    elseif script.Parent.Text == "Acid" or "acid" then
        script.Parent.Parent.Number.Value = 3
    end 
end)
#

acually

hushed cypressBOT
#

studio** You are now Level 3! **studio

fiery sapphire
#

you don't need it

#

@proper salmon the problem is not in mouseclickbutton1

#

I move it into another script

#

still broken

#

yeah let me revive focus lost system

#

like when you done type

#

it detect what you did

#

YES LOL

#

OMG

#

BRO

#

BRO

#

BRO

fiery sapphire
#

ALL I DID IS

#

DO FOCUSED LOST

#

LOL

#

@proper salmon thanks for helping me btw

#

@potent needle you too

#

@proper salmon you also

#

bro

#

wait

#

it still

#

HAPPEN

#

WTF

#

damn

#

I gonna die

#

what da hell

#

I do like this

#

script.Parent.FocusLost:Connect(function(a)
if script.Parent.Text == "Milk" or "milk" then
script.Parent.Parent.Number.Value = 1
elseif script.Parent.Text == "Coffee" or "coffee" then
script.Parent.Parent.Number.Value = 2
elseif script.Parent.Text == "Acid" or "acid" then
script.Parent.Parent.Number.Value = 3
end
end)

#

and then thing is

#

it give you value 1

#

by don't care any shit

#

bro

#

sure

#

YES IT GIVE ME ACID

#

LOL

#

IMAGINE

hushed cypressBOT
#

studio** You are now Level 3! **studio

fiery sapphire
#

I think problem is just roblox

#

@proper salmon

#

NOT YOU

#

@roblox

proper salmon
#

What?

#

Oh

#

Ok

#

Missclick?🤣

fiery sapphire
#

yes I did like that

proper salmon
#

It ok

fiery sapphire
#

OH MY GOD

hushed cypressBOT
#

studio** You are now Level 4! **studio

fiery sapphire
#

I KNOW IT NOW

#

@proper salmon

#

I NEED TO DEFINE FIRST

#

local x = script.Parent.Parent.Ordering.Text

#

YOU CANNOT DO script.Parent.Parent.Ordering.Text

#

OMG

drifting pendant
#

The conditions in your if statements are not being evaluated correctly.

you should do it something like this way

if script.Parent.Parent.Ordering.Text == "milk" or script.Parent.Parent.Ordering.Text == "Milk" then
    -- your code for ordering milk
elseif script.Parent.Parent.Ordering.Text == "coffee" or script.Parent.Parent.Ordering.Text == "Coffee" then
    -- your code for ordering coffee
elseif script.Parent.Parent.Ordering.Text == "acid" or script.Parent.Parent.Ordering.Text == "Acid" then
    -- your code for ordering acid
else
    -- your code for handling other cases
end

In your original code, the conditions "milk" or "Milk", "coffee" or "Coffee", and "acid" or "Acid" are always evaluated as true because non-empty strings are truthy in Lua.

fiery sapphire
#

yeah

#

that's easier

#

I completely forgot

#

sorry

fiery sapphire
#

alr

#

thx with all