RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"dialogue system"
-- server script for dialogue system local DialogueService = game:GetService("DialogueService") -- create a conversation local conversation = DialogueService:GetConversation("ConversationName") -- add dialogue to the conversation conversation:AddDialogue("Hello there!", "NPC") conversation:AddDialogue("Hi! How can I help you?", "Player") conversation:AddDialogue("I need your help with a quest.", "Player") conversation:AddDialogue("Sure, what do you need help with?", "NPC") conversation:AddDialogue("I need to find a rare item.", "Player") conversation:AddDialogue("I know where that item is! Meet me at the cave entrance.", "NPC") -- start the conversation for a player local function startConversation(player) conversation:StartConversation(player) end -- connect the startConversation function to a trigger part local triggerPart = game.Workspace.TriggerPart triggerPart.Touched:Connect(function(otherPart) local player = game.Players:GetPlayerFromCharacter(otherPart.Parent) if player then startConversation(player) end end)