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

Script killing player on DialogChoice doesnt work [?]

Hey guys! Actually made a script for my game which kills the player if the dialog choice but it seems to have an error Here's it by the way

local dialog = script.Parent--Or whatever the path is

dialog.DialogChoiceSelected:connect(function(player, choice) --This is getting the service when the choice is selected
	if choice == script.Parent.Else.Else1.Else2.Else3.SkyColor.A.Else4.OwnerName.C.Fail8 then
		game.Players.LocalPlayer.Character.Humanoid.Health = 0
	end
end)

I had thoughts that its because the DialogChoice has two variables = UserDialog and ResponseDialog, but even if I am true, I have no ideas how to fix the script.

The script itself is located in the Dialog, not in any of the DialogChoices. Thank you scripters!

UPD.: Rewriting the script to LocalScript didn't help me.

2 comments

1

It's probably because LocalScripts don't run in workspace. Instead, you change it back to normal script, but this time RunContext should be set to Client.

1

Also change line 5 to @Puppy_lovertheawsome's answer

1 answer

✓ Accepted answer

Try doing instead of game.Players.LocalPlayer.Blah blah blah do player.Character.Humanoid.Health = 0. Hope this helps

2 comments

0

Thank you! It became working after I changed my 5th line and also made the Server Script. Also thanks to @T3_MasterGamer

0

:)

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