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

Script killing player on DialogChoice doesnt work [?]

Asked by 1 year ago
Edited 1 year ago

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.

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. T3_MasterGamer 2189 — 1y
1
Also change line 5 to @Puppy_lovertheawsome's answer T3_MasterGamer 2189 — 1y

1 answer

Log in to vote
2
Answered by 1 year ago

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

0
Thank you! It became working after I changed my 5th line and also made the Server Script. Also thanks to @T3_MasterGamer nikitos54327 70 — 1y
0
:) Puppy_lovertheawsome 84 — 1y
Ad

Answer this question