#help
43 messages · Page 1 of 1 (latest)
So you want a way to detect HOW a player has died and correlate an animation from that death?
I'm sorry if you don't understand, I'm using a translator.
A few niche fixes you can do is replace the wait and task.wait(), and if you need to wait < 0.1 seconds, just put nothing within the wait unless absolutely nessacary
Was what I said below that what you asked?
dont use wait() always use task.wait()
heh.. I already said that pal
My point is that if a person died from a npc, there would be a kill animation, if a person died through their own fault, let's say, fell on the killing part, there would be no animation
nah
idk if its the best solution but what you can do is you can fire a remoteevent everytime someone dies from an npc instead of the normal humanoid.died
the same for the players faults
Oh you can write the code on for the npc itself and make a custom event if it kills somebody
I'll give it a try
i dont think he means seperate animations for every npc
Depends on the npc's mesh
No, I've only got one npс.
oh ok
hold on wait like 2minutes
ok
local player = game.Players.LocalPlayer
local Rake = workspace.Filter.JsScene.RDummy
local RakeHumanoid = workspace.Filter.JsScene.RDummy.Humanoid
local DeadEvent = game.ReplicatedStorage.DeadEvent
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local cam = workspace.CurrentCamera
local Jumpscare = script.Parent.Jumpscare
local Hit = script.Parent.Hit2
local Susto = script.Parent.Susto
local Death4 = script.Parent.Death4
local BloodHourAnimation = RakeHumanoid:LoadAnimation(Rake:FindFirstChild("Animation"));
humanoid.Died:Connect(function()
cam.CameraType = Enum.CameraType.Scriptable
script.Parent.CFrameFix.Disabled = false
Jumpscare:Play()
BloodHourAnimation:Play()
Death4:Play()
Susto:Play()
wait(0.01)
cam.CFrame = workspace:FindFirstChild("Filter").JsScene.RDummy.HumanoidRootPart.CameraPart.CFrame
wait(0.4)
Hit:Play()
wait(1)
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
script.Parent.CFrameFix.Disabled = true
wait(4)
DeadEvent:FireServer()
end)```
You'd want to get a reference of ALL humanoids in the game and make a death connection (preferably use :Once so the memory doesn't increase by a lot)
To do this you could do a Player.CharacterAdded connection within that script and put all of the humanoids within a table
And loop through it and create the death connections
I've only got one humanoid, maybe two.
can you show me on my script?
No no
I can give you an example script and explain what it's doing

local Players = game:GetService("Players")
local RakeModel = ...
--This event is made to make it easier to see what character was added or removed
local OnCharactersChangedEvent = Instance.new("Bindable")
local ActiveCharacters = {} --Alive players
local ActiveDeathConnections = {} --This will hold our connections for our humanoids
--This is a table that will hold what player got recently hit
--If a player dies and their character is within this table, the animation will proc
local hitPlayers = {}
Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(Char)
ActiveCharacters[plr.Name] = Char
OnCharactersChangedEvent:Fire(...) --put whatever params you need
end)
plr.CharacterRemoved:Connect(function(Char)
if not ActiveCharacters[plr.Name] then return end
OnCharactersChangedEvent:Fire(...) --put whatever params you need
ActiveCharacters[plr.Name] = Char
end)
end)
--The event that listens for character's being inserted or removed inside the table
OnCharactersChangedEvent.Event:Connect(function(...)
... --Set connections for player's being added or removed
end)
RakeModel.Hitbox.Touched:Connect(function(touchPart) --Arbitrary hitbox touch connection
if not touchPart.Parent:FindFirstChildOfClass("Humanoid") then return end
if hitPlayer[Players:GetPlayersFromCharacter(touchpart.Parent)] then return end
hitPlayer[Players:GetPlayersFromCharacter(touchpart.Parent)] = touchPart.Parent
end)
I'm not gonna finish this since I shouldn't give free script sto anyone
But this will get players who join the game and detect who is alive or not spawned in
If a character spawns, you can create a humanoid event
to DETECT when toi play the animation, the player who is hit would be added to the hitPlayers table
if they exist in that table, play the animation
You would need to set the connections within the custom event