#Server script .Died not triggering

1 messages · Page 1 of 1 (latest)

vestal flax
#

my server script isnt triggering .Died event. BUT the local script is detecting just fine. AND this is only the case in ONE SPECIFIC SCENARIO.
scenario explained in a comment of mine

#

this part of the script is the scenario im talking about.

#

i have an explosion modulescript (which is the hit) and anything that hits it will go through a whole process. However, before said process, i set the humanoid's health to 0 to trigger the .Died events. and yes this is in a server script.

kind monolith
#

just send the whole script

#

wait

#

is it in a local script

#

the died event

vestal flax
#

there are 2

#

1 in local 1 in server

kind monolith
#

well u haven’t sent the full code but

#

is the local script inside workspace

vestal flax
#

no

#

startercharacter

#

and the server .Died is in serverscriptserv

#

also sometimes (around 60-70% of the time) my character's parts gets destroyed, i've been trying to find if theres a script responsible for it but couldnt find any

#

if you know whats up with that then please do tell me

#

but i am pretty sure its some jank script running around

kind monolith
#

show code

vestal flax
#

or the server script?

kind monolith
#

u said the local script was fine so

#

the server script

vestal flax
#

alr im guessing ur talking about the kill:Fire()

kind monolith
#

is it there ah nvm

vestal flax
#

well i also added a print at some point

#

on the .Died

#

so the problem is actually .Died not triggering

kind monolith
#

just wondering whether u destroy the humanoid

#

During the explosion

vestal flax
#

nope

oak skiff
#

maybe do a remote event if you said it works on client but idk why it doesn't work on server it could be due to an error in explosion mod

vestal flax
#

however the problem is, kills are delayed by the OTHER player's ping

#

so kills could just get delayed or even missing

#

with high enough ping

#

so i need 2 events

oak skiff
#

I think there's a property for explosions called break joints on death and you might need to disable that so it doesn't destroy the parts

#

but then I think you need to program the humanoid being killed

vestal flax
#

the module script doesnt use explosion isntances

oak skiff
#

it doesnt?

vestal flax
#

its a kill ball basically

#

that just grows and stuff

#

detects for collisions and do its thing

oak skiff
#

how come you don't include the died logic after the ball kills the player instead of setting up a died event

vestal flax
#

there are other ways to kill the player

#

and setting up all that is just a hassle

oak skiff
#

what if you did wait for child and then the humanoid instead of iterating through the characters children and then checking if it's a humanoid

brave chasmBOT
#

studio** You are now Level 1! **studio

vestal flax
#

not sure how that'd help but sure i'll try it

oak skiff
#

or you could set up your own died event instead of relying on the humanoid

#

like a bindable event

vestal flax
#

i dont think it changed anything m8

vestal flax
oak skiff
#

is humanoid nil?

vestal flax
#

in the scenarios the humanoid is present

oak skiff
#

what about changing state to dead

vestal flax
#

lemme try that

quartz jackal
#

maybe one script is running before the other

vestal flax
#

however my search for that rogue script was not successful

quartz jackal
#

add a .wait() to check or a bunch of prints to debug

vestal flax
#

i tried using that finder tool

vestal flax
#

and i can confirm the problem is that triggering

#

i havent done any other debugging other than that, since im not quite sure what else there is to debug

vestal flax
quartz jackal
#

is the .Died running itself

vestal flax
#

and again, humanoid is still present

vestal flax
#

no

quartz jackal
#

no like is it js not running

oak skiff
#

wait try plain resetting

#

and see if it fires

vestal flax
#

every other scenario works

#

other explosions, resetting, hitboxes

#

all those works

#

just this scenario

vestal flax
quartz jackal
#

btw man u dont need to loop through the rig to find humanoid

#

could just do WaitForChild

vestal flax
quartz jackal
#

mk

vestal flax
#

cuz i was going for a hyperlaser hit effect yknow

#

so mind as well (i've changed it to :waitforchild() as par to @oak skiff 's suggestion anyways)

quartz jackal
#

aight calm

#

set dead to true and remove the return end js for debug rq

#

or just add a warn to it

vestal flax
#

commented them out

quartz jackal
#

is the .Died not running because of the return end

#

or is it simply not running

vestal flax
#

same result

#

i mean i did comment out the return end so its not that

quartz jackal
#

actually

#

the .Died might be running after ts dead

#

so set dead to true if its alr dead

vestal flax
#

yeah that was why i added that

quartz jackal
#

no like if
hum.Health <= 0 then dead = true end

vestal flax
#

huh

quartz jackal
#

and if its that fails then trigger the humanoid.died

vestal flax
#

what do i do that on a run service?

quartz jackal
#

gimme a sec

vestal flax
#

honestly using run service might be smart

quartz jackal
#

yh i guess

vestal flax
#

but unideal...

#

would be abit laggier

oak skiff
#

when you use wait for child and get the humanoid is it actually killing it when you set its health to 0?

vestal flax
#

wdym

oak skiff
#

does that actually kill the player

quartz jackal
#
if hum.Health == 0 then
  dead = true
else
  print("alr dead vro")
vestal flax
#

yeah

vestal flax
quartz jackal
#

check if humanoid is dead already before running

#

.Died

quartz jackal
oak skiff
quartz jackal
#

codeblocks

#

3 backticks

#

then lua

oak skiff
#

do you need some sort of extension to do that

quartz jackal
#
print("hi")
#

nah

#

`

oak skiff
#

oh

quartz jackal
vestal flax
#

on the character added event.?

quartz jackal
#

yh

quartz jackal
vestal flax
#

didnt work

#

oh

quartz jackal
#

srry

#

im bein dum

vestal flax
#

nothin

#

no print statement or anythin

quartz jackal
#

aight one more then i quit

#

use .Healthchanged

vestal flax
#

or getchangedpropertysignal?

oak skiff
#
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character.AttributeChanged:Connect(function(name)
            print(name)
        end)
    end)
end)

local hit = workspace -- replace
for _, char : Model in hit:GetChildren() do
    if char:IsA("Model") and char:FindFirstChildOfClass("Humanoid") then
        char:FindFirstChildOfClass("Humanoid").Health = 0
        char:SetAttribute("Dead", true)
    end
end
quartz jackal
#

yea sure

quartz jackal
#

if hp<=0 then
print("is dead twin")

vestal flax
#

sick it works

#

hold on though

#

should i get a .Died event

#

just in case the player dies from something other than health

#

like neck gone or something

quartz jackal
#

yh

oak skiff
#

if youre going to destroy its neck and interpret it as the player being killed you might as well set the health to 0 after destroying the neck

quartz jackal
#

js check what killed the player

vestal flax
quartz jackal
vestal flax
#

i've checked with script finder (keyword : :Destroy()) and nothing showed up

quartz jackal
#

wdym by they get "destroyed"

#

like they disappear

#

or blow up

vestal flax
#

they're GONE

#

only the limbs

#

humanoid, starter character scripts, they're all there

quartz jackal
#

check for debris service

vestal flax
#

wait what

#

you can check debris storage?

kind monolith
#

Bro what?

quartz jackal
#

no like if you used Debris service

#

check that

vestal flax
#

nothing

#

i never use debris

quartz jackal
#

hmmmm

oak skiff
#

what about setting the parent to nil

brave chasmBOT
#

studio** You are now Level 2! **studio

vestal flax
quartz jackal
#

uhhhhhhhhhhh check the children of the rig

#

on death

vestal flax
#

lemme keep testing hold on, cuz after i changed the health property the scneario b seems to not be showing up anymore

quartz jackal
#

if their destroyed then ion know

#

else it might be a visual glitc

vestal flax
#

ok scenario b seems to just be gone now??

oak skiff
#
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character.DescendantRemoving:Connect(function(descendant)
            -- check to see what is being removed
        end)
    end)
end)
quartz jackal
vestal flax
#

well i guess im not complaining

#

imma set up the .Died now

#

prayign it wont break everything somehow

quartz jackal
#

aight nice

vestal flax
#

alright everything seems to be working fine

#

thx so much man this has caused alot of confusion

quartz jackal
#

np

kind monolith
vestal flax
brave chasmBOT
#

studio** You are now Level 15! **studio

vestal flax
#

the health was changing but the death aint workin

#

so that works

#

i doubt you'd encounter a similair situation though

outer quiver
vestal flax
#

module script*

chrome mantle
vestal flax
#

uhm the problem was already solved yesterday..

chrome mantle
#

Oh

vestal flax
#

and it gets reassigned every time the player respawns

chrome mantle
#

Mark it as solved then