#help

43 messages · Page 1 of 1 (latest)

shy shard
#

What are you saying bro

#

So you want a way to detect HOW a player has died and correlate an animation from that death?

burnt ibex
shy shard
#

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

shy shard
rancid willow
#

dont use wait() always use task.wait()

shy shard
rancid willow
#

oh

#

i misread sorry

#

i thought u said wait or task.wait

burnt ibex
shy shard
#

nah

rancid willow
#

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

shy shard
burnt ibex
#

I'll give it a try

rancid willow
#

i dont think he means seperate animations for every npc

shy shard
burnt ibex
rancid willow
#

oh ok

burnt ibex
rancid willow
#

hold on wait like 2minutes

burnt ibex
#

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)```
shy shard
#

Please do this so it's colored

shy shard
#

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

burnt ibex
burnt ibex
shy shard
#

No no

shy shard
burnt ibex
shy shard
#
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