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

Proximity Button wont kill after jumpscare, how to resolve?

Asked by 2 years ago
local Jumpscare = script.Parent.Frame
local ClickPart = game.Workspace.SCP000Keyboard.ProximityPrompt
local JumpscareSound = script.Parent.SCP000JUMPSCARE
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChildOfClass("Humanoid")
Jumpscare.Visible = false
ClickPart.Triggered:Connect(function()
    Jumpscare.Visible = true
    JumpscareSound:Play()
    wait(1.3)
    Jumpscare.Visible = false
    if humanoid then
        humanoid.Health = 0
    end
end)

2 answers

Log in to vote
0
Answered by 2 years ago

Try removing the if statement and are there any errors?? also on line 8 you can try filling in the () with (plr) It may help. Hope this helps!!

0
Also if there are no errors try adding print("Test") around your script to try debugging theking66hayday 841 — 2y
Ad
Log in to vote
0
Answered by 2 years ago

I believe its due to the fact that your character isn't updating after death. I've had this problem before as well and don't know why, as most people say it should be fine but if you simply add this somewhere in the script, preferably at the bottom it should work.

player.CharacterAdded:Connect(function(newCharacter)
character = newCharacter
end)

Also, killing someone from the client isn't the best approach, especially if the server sizes are greater than 1.

Answer this question