You're on the right track! So, what's important to know (and I'm unaware if you're already doing this) is that DialogChoiceSelected is a client-side event only, and therefore needs to be in a local script of sorts. Other than that, you essentially have it down. With your "choice" parameter in the function / event, you have the DialogChoice instance itself. When I tested things out, I (personally) named the DialogChoice something like "KickAction," and ran a simple if choice.Name == "KickAction" then to check if they selected the choice we want to kick them for. The only thing you have to make sure is that you don't name any other dialog choices "KickAction," or whatever you name the deadly dialogue option. Then just put your player:Kick("") nestled in the "if then" statement. You should be good!
The code I used in my testing place is as follows:
local d = workspace.Part.Dialog
d.DialogChoiceSelected:Connect(function(p, c)
if c.Name == "KickAction" then
p:Kick("bruh")
end
end)
Hope this helped! Make sure to accept this as an answer if it solved your problems :)
1 comment
Do you need to get the player on line 2 if it's the first argument of the function on line 1? Anyways, try player:Destroy() maybe.