Scripting Roblox dialog using badges

One of the games I am working on involves quests and uses the default Roblox dialog. I want to create a badge-based system where if the player has a certain badge, the InitialPrompt will change.

The issue is I do not know how to script this type of system.

I have looked for solutions on the DevHub, and in various DevForum topics.

hi mate im not sure if this will help but you can use this to do somethin g if the player has a certain badge :+1:
local Badge1Event = game.ReplicatedStorage.Badge1Event

local BadgeService = game:GetService(“BadgeService”)

local BadgeId = **badge id here ***

game.Players.PlayerAdded:Connect(function(player)

if BadgeService:UserHasBadgeAsync(player.UserId,BadgeId) then

Badge1Event:FireClient(player) ** for example have a script in the startplayerscripts trigger when this remoteevent is run from this server script ****

end

end)

local player = game.Players.LocalPlayer
local Badge1Event = game.ReplicatedStorage.Badge1Event
local coming = player.PlayerGui:waitForChild(“coming”)

Badge1Event.OnClientEvent:Connect(function()
coming.Box.Locked1.Visible = false

do u have script for just ur standard dialog

It will be pretty simple, u will need UserHasBadgeAsync which returns true or false, from there change the dialogue text locally so it doesn’t affect others

I modified the code a little but it won’t work

local Badge1Event = game.ReplicatedStorage.Badge1Event

local BadgeService = game:GetService("BadgeService")

local BadgeId = 2127258598

	game.Players.PlayerAdded:Connect(function(player)

		if BadgeService:UserHasBadgeAsync(player.UserId,BadgeId) then

		script.parent.dialog.InitialPrompt = "Test" --** for example have a script in the startplayerscripts trigger when this remoteevent is run from this server script ****

	end

	end)

hi mate the code you changed is a trigger for the charecter script there are two scripts required to make it work. the one you change you need to have an event from the server in the script it is badgeEvent ** was just an example ***

so where you entered : script.parent.dialog.InitialPrompt = “Test”

This must be there : Badge1Event:FireClient(player) ** this fires a remoteevent that the other script sees to do something and is only going to happen to the single player not all players like fireallclients***

You MUST also have a remote event in replicated storage called " BadgeEvent" to make it work

also this script must be in startplayerscripts as a local script :

local player = game.Players.LocalPlayer
local Badge1Event = game.ReplicatedStorage.Badge1Event
local coming = player.PlayerGui:waitForChild(“coming”) ***** this is your gui name ***

Badge1Event.OnClientEvent:Connect(function()
coming.Box.Locked1.Visible = false ***** this is where you locate you dialog to run / make visable etc… )

end

The dialog I am using cannot be toggled between being visible and not. The dialog is Roblox’s dialog.
Explorer

These are the properties:
Properties

its Parent

this looks irelevent

Hey mate all good yes it will only work for a startgui to either make it visable or enbled disabled etc… it can not control the workspace from a local script.

this must be there or the server script does not know where the remote event is localed for when you call the onclient event further down :+1: