Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years 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

0
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; https://developer.roblox.com/en-us/api-reference/function/Player/Kick Spjureeedd 385 — 3y

1 answer

Log in to vote
0
Answered by 2 years ago

Hello,

You need to use DialogChoiceSelected.

Please read and understand what im about to tell you.

local Player = Instance.new("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
    end
end)

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

Ad

Answer this question