Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make Dialog pop up without a player clicking it?

So sorta like the system in work at a pizza place he scripted the Dialog to pop up saying something whenever the player clicks the wrong button or the correct button when the NPC's are ordering how does he accomplish this effect? I've looked all over the Wiki and haven't found anything related too it using dialog.. Can anyone help me?

I don't know how much more I need to emphasize the fact that I want the Dialog to pop up above the NPC's head and have text WITHOUT interacting with the Dialog

local script inside starterPlayerScripts trying to achieve the effect on line 32 and 34

local job = workspace.Job
local character = game:GetService("Players").LocalPlayer.Character
local m = Instance.new("Model", character)
m.Name = "JobService"
local a = Instance.new("BoolValue", character)
a.Name =  "Customer"
local b = Instance.new("StringValue", character)
b.Name = "CustomerChoice"
local yel = job.Yel
local blu = job.Blu
local red = job.Red
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
--mouse.TargetFilter = workspace.Job

while wait(0.1) do 
	if mouse.target == yel then
		yel.SelectionBox.Adornee = yel
	elseif mouse.target == blu then
		blu.SelectionBox.Adornee = blu
	elseif mouse.target == red then
		red.SelectionBox.Adornee = red
	else
		blu.SelectionBox.Adornee = nil
		red.SelectionBox.Adornee = nil
		yel.SelectionBox.Adornee = nil
		end
end

mouse.MouseButton1Down:connect(function(click)
	local customerChoice = character.JobService.CustomerChoice
	if mouse.target == customerChoice.Value then
		-- dialog here
	elseif mouse.target ~= customerChoice.Value then
		-- dialog here
	end
end)

3 comments

0
0

Gee a page with nothing thanks how could I have been so stupid e.e and I don't know how much more blantant I can be by, Dialog that shows text pops up without the player having to interact with the NPC or with the dialog please actually read my post next time..

1

Well then, you should have emphasized that point. You never did so in your original question. You would have to custom make the GUI and potentially use magnitudes to detect the closest "cashier" to take the order. Dialogs do not show automatically, they show with client interaction.

1 answer

✓ Accepted answer

Wait, I understand your question now. I thought you were talking about the dialog responses. So you're wanting to detect if the user makes the correct choice or not on the register?

To achieve this, you need to set up multiple events that will eventually be disconnected. You'd want to somehow communicate the correct response to the script. Once establishing the variables, this will prevent the script from erroring out. Now we will want the script to get the correct response. Let's just say when the user makes the right choice in the dialog box, the script will change a value in Workspace that will also provide the correct response.

Now I typed up the script before making this mini-tutorial, so try to follow along. You need to establish variables for what you will make events later on in the script. That way when you go to disconnect the events you will not receive an error. Whenever the CorrectResponse StringValue in Workspace is changed, the function will make new events and set them as the variables we set up. Whenever the user chooses a brick the script will execute the Check function which will determine if the correct response was chosen or not. If the correct response was chosen, then the specified brick will say "Thank you" and the function KillAll is called. KillAll is the function I created to kill all the events using the disconnect function. That way you can't just go, oh Pepperoni first then Cheese right after that.

local Pepperoni, Cheese, Sausage, Soda

function KillAll()
    Pepperoni:disconnect()
    Cheese:disconnect()
    Sausage:disconnect()
    Soda:disconnect()
end

function Check(Correct, Chosen)
    if Correct == Chosen then
        game:GetService('Chat'):Chat(game.Workspace.PartYouWantToShowThisMessageOn, "Thank you!")
        KillAll()
        --Fill in the rest.
    else
        game:GetService('Chat'):Chat(game.Workspace.PartYouWantToShowThisMessageOn, "I am never coming back!")
        KillAll()
    end
end

game.Workspace.CorrectResponse.Changed:connect(function(Correct) --Assume this is a StringValue in the Workspace.
    Pepperoni = game.Workspace.PepperoniOption.ClickDetector.MouseClick:connect(function()
        Check(Correct,"Pepperoni")
    end)
    Cheese = game.Workspace.CheeseOption.ClickDetector.MouseClick:connect(function()
        Check(Correct,"Cheese")
    end)
    Sausage = game.Workspace.SausageOption.ClickDetector.MouseClick:connect(function()
        Check(Correct,"Sausage")
    end)
    Soda = game.Workspace.SodaOption.ClickDetector.MouseClick:connect(function()
        Check(Correct,"Soda")
    end)
end)

######Hopefully this answered your question. I am sorry for the miscommunication beforehand. I did not completely understand your question to begin with. If you have any questions or you want further explanation on how this script works, just post in the comments below.

2 comments

1

Note: Bubble Chat needs to be enabled for the :Chat function to work.

0

k Thank you finally! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.