So I was making a custom NPC interaction system, and it wouldn’t work. A snippet of the script is as follows:
local button1 = script.Parent.TextButton1
button1.MouseButton1Click:Connect(function()
print("e")
if onchatlength == 0 then
_storyline = "Coffee please"
onchatlength = onchatlength + 1
end
end)
When I click the button, it doesn’t print “e”. This is in a local script, located in the screenGUI, which is in the starter GUI. Why is this happening?
There should be an option called ZIndex on the button, set that to bigger than anything overlapping it. If you don’t know what to set it to, just do like 5.
Very odd, MouseButton1Click has worked for me and that script should work.
try messing around with the actual properties of the text button maybe there’s a property that is disabling it.
That’s wearied its not working for you, I just tried it with the exact same script. Herse what I got and the output is saying e
local button1 = script.Parent.TextButton1
-- Sometimes separating lines help. ( For me at least )
button1.MouseButton1Click:Connect(function()
print("e")
if onchatlength == 0 then
_storyline = "Coffee please"
onchatlength = onchatlength + 1
end
end)