Log in to vote

Does anyone know how to make it so a dialogue option kicks a player from the game?

Asked by 10 days ago

I'm making an npc for my game and I'm trying to make it so the player will be kicked if they choose a mean answer, I'm really new to scripting so if someone could just tell me the script that would help a lot! Tysm in advance

I wouldn't suggest you to kick player's if they choose a reply that you have made as an option. Many people like to try all dialogue replies if possible to know what they do. But since you asked; Spjureeedd 363 — 10d

1 answer

Log in to vote
Answered by 5 days ago


You need to use DialogChoiceSelected.

Please read and understand what im about to tell you.

local Player ="Player") -- Player function

workspace.Dialog.DialogChoiceSelected:connect(function(player,choice) --Make sure to say instead of "workspace" where the NPC actually is, if the NPC is located in Workspace, then leave the script like that.
    if choice.Name == "No, you suck" then --Change "No" with what the name of the Dialog is
        Player:Kick("Thats what you get for saying I suck")
    elseif choice.Name == "Yes, you're the best player ever" then --Change "Yes, you're the best player ever" To the name of the dialog choice
        player.Character.Humanoid.Health = 1000

Please reply to me when you have any questions, when the script isn't working, etc.


Answer this question