So this script is not receiving mouse input on the BillboardGui. Even when the BillboardGui has active turned on all the objects in the gui nothing happens. My LocalScript is in StarterGui in a ScreenGui that has two frames one of which has a LocalScript inside (The frames have different names). The BillboardGui is inside of the frame with the LocalScript and has a name called ClickToTalk. I am making my own dialog system with my own click to talk button so thats why it's named ClickToTalk. Note: Some of my code is very messy but the reason is because when I tried to use more efficient code it broke the script for some reason. Example on line 78 I wanted to use a simple for loop but it broke that part of the code. I have tried using pcall but nothing has worked. The thing is the script works in studio mode just not the real game. Heres my code:

local Button = script.Parent.Hello -- I know this is a bad name for a button

-- Dictionary that stores all the debouce variables
local Chat = {
	["InitialChat"] = true;
	
	["DB2"] = false;
	["DB3"] = false;
	["DB4"] = false;
	["DB5"] = false;
	["DB6"] = false;
	["DB7"] = false;
	["DB8"] = false;
	["DB9"] = false;
	["DB10"] = false
}

-- Dialog function
local function Dialog()	
	print("Running")
	
	if Chat.InitialChat then	
		script.Parent.TextLabel.Text = "Text."
		script.Parent.Hello.Text = "Response."
		
		Chat.DB2 = true
		Chat.InitialChat = false
	elseif Chat.DB2 then
		script.Parent.TextLabel.Text = "Text."
		script.Parent.Hello.Text = "Response"		
		
		Chat.DB3 = true
		Chat.DB2 = false
	elseif Chat.DB3 then
		script.Parent.TextLabel.Text = "Text"
		script.Parent.Hello.Text = "Response"		
		
		Chat.DB4 = true
		Chat.DB3 = false
	elseif Chat.DB4 then
		script.Parent.TextLabel.Text = "Text."
		script.Parent.Hello.Text = "Response"		
		
		Chat.DB5 = true
		Chat.DB4 = false
	elseif Chat.DB5 then
		script.Parent.TextLabel.Text = "Text"
		script.Parent.Hello.Text = "Response"		
		
		Chat.DB6 = true
		Chat.DB5 = false
	elseif Chat.DB6 then
		script.Parent.TextLabel.Text = "Text."
		script.Parent.Hello.Text = "Response"		
		
		Chat.DB7 = true
		Chat.DB6 = false
	elseif Chat.DB7 then
		script.Parent.TextLabel.Text = "Text!"
		script.Parent.Hello.Text = "Response"		
		
		Chat.DB8 = true
		Chat.DB7 = false
	elseif Chat.DB8 then
		script.Parent.TextLabel.Text = "Text."
		script.Parent.Hello.Text = "Response"		
		
		Chat.DB9 = true
		Chat.DB8 = false
	elseif Chat.DB9 then
		script.Parent.TextLabel.Text = "Text."
		script.Parent.Hello.Text = "Response"		
		
		Chat.DB10 = true
		Chat.DB9 = false
	elseif Chat.DB10 then
		script.Parent.TextLabel.Text = "Text."		
		-- This is messy but the for loop did not work for some reason

		Button.Text = "Will close in 5 seconds"
		wait(1)
		Button.Text = "Will close in 4 seconds"
		wait(1)
		Button.Text = "Will close in 3 seconds"
		wait(1)
		Button.Text = "Will close in 2 seconds"
		wait(1)
		Button.Text = "Will close in 1 seconds"
		wait(1)
		Button.Text = "Will close in 0 seconds"
		
		script.Parent.Parent.Enabled = false
			
		script.Parent.ClickToTalk.Enabled = true
	end
end

-- Calls the function whenever the player clicks the response button
Button.MouseButton1Click:Connect(Dialog)

-- Starts dialog when the player clicks the billboard gui
script.Parent.ClickToTalk.Frame.Click.MouseButton1Click:Connect(function()
	script.Parent.Parent.Enabled = true
	script.Parent.ClickToTalk.Enabled = false
	
	Chat.InitialChat = true
	
	
	Chat.DB2 = false
	Chat.DB3 = false
	Chat.DB4 = false
	Chat.DB5 = false
	Chat.DB6 = false
	Chat.DB7 = false
	Chat.DB8 = false
	Chat.DB9 = false
	Chat.DB10 = false
	
	Dialog()
end)

I don't know why this is not working. Thanks in advance to anyone who helps me.

2 comments

0

Is MouseButton1Click on serverside?

0

No