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

How To Make A Dialog Choice Kick You? [closed]

Asked by 2 years ago

ive posted one of these before and have looked around the internet but nothing has worked i need a script that would kick someone if you choose a specific dialogchoice what type of script would it be? and where? cuz i tried in a normal script in a dialogchoice and it didnt work even with an alt also do you put anything specific or change anything to something specific (other than kick message)

0
I'll post you a script in a few minutes RektwayYTB 123 — 2y
0
There Is A Way But It Is Lengthy kidsteve923 139 — 2y

Closed as Not Constructive by JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Make sure this is a Local Script

Use this script, This script will kick the player.

Insert this Script in a LocalScript inside of a Dialog Object

Local Script:

local Dialog = script.Parent -- Dialog

Dialog.DialogChoiceSelected:Connect(function()
       local Player = game.Players.LocalPlayer
       local Msg = "" -- Change it to your message!
       Player:Kick(Msg) 
end)

I hope this works for you :D

0
it didnt :( JmoneyPlayzOfficial 49 — 2y
Ad
Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

What You Can Do Is Use GUIS Aka A Custom Dialog UI To Make It

To Detect When The NPC Dialog Start Or Detect When The Player Is Near The NPC And Presses E Script Is

Local Script

-- Instruction

-- Put This In A ScreenGui With A TextLabel Called Response
-- Make A Part Called NPC With A BillboardGui And A TextLabel
-- And Your Ready :D


local plr = game.Players.LocalPlayer
local NPC = game.Workspace.NPC
local Db = false
local char = plr.Character or plr.CharacterAdded:Wait()
game:GetService("RunService").RenderStepped:Connect(function()
    if not Db then
        Db = true
        if (char.Head.Position-NPC.Position).Magnitude <10 then
            NPC.BillboardGui.Enabled = true
            game:GetService("UserInputService").InputBegan:Connect(function(Inp,GPE)
                if Inp.KeyCode == Enum.KeyCode.E then
                    script.Parent.Response.Visible = true
                    NPC.BillboardGui.TextLabel.Text = "Wanna Quit?"
                    NPC.BillboardGui.Size = UDim2.fromOffset(500,100)
                    script.Parent.Response.MouseButton1Click:Connect(function()
                        plr:Kick("ok")
                    end)
                end
            end)
        else
            script.Parent.Response.Visible = false
            NPC.BillboardGui.Size = UDim2.fromOffset(50,50)
            NPC.BillboardGui.TextLabel.Text = "E"
            NPC.BillboardGui.Enabled = false
        end
        wait(0.1)
        Db = false
    end
end)