I keep getting an "attempt to call a nil value" in my output every time I click on a button, here's my scripts.
local clickDetector = script.Parent.ClickDetector
if script.Parent.Parent.Name == ("Can I get a burrito?") then
function onMouseClick()
script.Parent.Parent.Name = ("Thank you!")
end
end
clickDetector.MouseClick:connect(onMouseClick)
Note that the first script is the same for every name text
while true do
creativlyNamedVariable = math.random (1, 4)
if creativlyNamedVariable == 1 then
script.Parent.Name = ("Can I get a taco?")
elseif creativlyNamedVariable == 2 then
script.Parent.Name = ("Can I get some nachos?")
elseif creativlyNamedVariable == 3 then
script.Parent.Name = ("Can I get a burrito?")
elseif creativlyNamedVariable == 4 then
script.Parent.Name = ("Can I get a soda?")
if script.Parent.Name == ("Thank you!") then
wait(30.8)
creativlyNamedBye = math.random (1, 3)
if creativlyNamedBye == 1 then
script.Parent.Name = ("Bye!")
elseif creativlyNamedBye == 2 then
script.Parent.Name = ("Cya!")
elseif creativlyNamedBye == 3 then
script.Parent.Name =("Alright, have a good one!")
end
end
end
wait(35.8)
end
EDIT: So I just tested it again. But it works with some buttons one time, and then others when I test it another time.

2 comments
what line?
No idea, just sometimes when I click on the button it will say "attempt to call a nil value". Don't know why at all. I did try to add variables, but that didn't help. sadly :(