Problem with a Dialogue script

Greetings everybody, I’m trying to make a script that kicks the player if they select the wrong choice using Dialog, I have made the script, it brings no errors but it does nothing (doesn’t kick the player whatsoever)

local Players = game:GetService("Players")

workspace.SomePart.Dialog.DialogChoiceSelected:connect(function(player,choice)
	if choice.Name == "KickAction" then
		player:Kick()
	end
end)

image

You should try to add a print(choice.Name) in line four and put the if statement to line 5.
Tell us what it prints out!

Nvm I found the issue:
LocalScripts don’t run in the workspace, they only run in ReplicatedFirst, StarterPlayer, StarterCharacter and StarterGui.

You can read this if you hover over the local script in the “Insert Object” window.

Prints nothing.
I aswell tried the script from ReplicatedFirst and StarterPlayer, but still doesn’t work , and neither does it print anything out.

Try to print("running") at the last line of the script.
Does I print anything?

Well I managed to find out what caused the problem, it seems that it works when you put in StarterGUI. But still thanks for the help

Uhh could you mark my post as the solution, because I told you to put it there lol…

Yea will do it

(stupid char limit!!!)