Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How To Make A Dialog Choice Kick You?

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)

2 comments

0

I'll post you a script in a few minutes

0

There Is A Way But It Is Lengthy

2 answers

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

1 comment

0

it didnt :(

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.