Use Animation.Completed:Connect(function() for when you want them to die after the animation.
Also, it might wait four seconds after the “Snap” animation is done, so if it does just remove that wait(4)
so like this?
local function Plague()
if descendant:IsA("Humanoid") then
local humanoid = descendant
Snap:Play()
end
Snap.Completed:Connect(function()
descendant.Character.Humanoid:TakeDamage(100)
end
)
As ript said, you should use Animation.Completed but I don’t know here it is your script but you should put it in the server script service and there you go the code:
game.Players.PlayerAdded:Connect(function(player)
local Snap = script.Animation
local Workspace = game.Workspace
local descendant = game.Workspace:GetDescendants()
for i,v in pairs(game.Workspace:GetChildren()) do
if v:FindFirstChild("Humanoid") then
local hum = v:FindFirstChild("Humanoid")
local anim = hum:LoadAnimation(Snap)
anim:Play()
anim.Completed:Connect(function()
hum:TakeDamage(100)
print(hum.Parent.Name.. " died.")
end)
end
end
end)
I hope this can help you
it’s supposed to be a function that will be ran though
Lol you can use the term “workspace” to refer to game.Workspace, no variable is required.But yeah that’s the approach.
true dat, my bad, im sorry lol
Then you can put his code into a function like
Sorry about the wacky formatting but yeah
local function plage()
local Snap = script.Animation
for i,v in pairs(game.Workspace:GetChildren()) do
if v:FindFirstChild("Humanoid") then
local hum = v:FindFirstChild("Humanoid")
local anim = hum:LoadAnimation(Snap)
anim:Play()
anim.Completed:Connect(function()
hum:TakeDamage(100)
print(hum.Parent.Name.. " died.")
end)
end
end
end
I got this error. (Also changed Function name to Neck)
show me the script and i’ll be sure about it but basically you should change the “anim” for the “Snap” varible
--SCRIPT WRITTEN BY CLEETUSCHAN--
local Players = game.Players:GetChildren()
local Workspace = game.Workspace
local descendant = game.Workspace:GetDescendants()
local function Neck()
local Snap = script.Animation
for i,v in pairs(game.Workspace:GetChildren()) do
if v:FindFirstChild("Humanoid") then
local hum = v:FindFirstChild("Humanoid")
local anim = hum:LoadAnimation(Snap)
anim:Play()
anim.Completed:Connect(function()
hum:TakeDamage(100)
print(hum.Parent.Name.. " died.")
end)
end
end
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if (msg == "May you rest in peace.") then
Neck()
end
end)
end)
yeah that’s it you must change the variables ig but i’ll test it out too
actually it is not completed, it is Stopped,
local function neck()
local Snap = script.Animation
for i,v in pairs(game.Workspace:GetChildren()) do
if v:FindFirstChild("Humanoid") then
local hum = v:FindFirstChild("Humanoid")
local anim = hum:LoadAnimation(Snap)
anim:Play()
anim.Stopped:Connect(function()
hum:TakeDamage(100)
print(hum.Parent.Name.. " died.")
end)
end
end
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if (msg == "May you rest in peace.") then
neck()
end
end)
end)
It’s still not working right. I just die and it doesn’t play the animation. No errors either
--SCRIPT WRITTEN BY CLEETUSCHAN--
local Players = game.Players:GetChildren()
local Workspace = game.Workspace
local descendant = game.Workspace:GetDescendants()
local function Neck()
local Snap = script.Animation
for i,v in pairs(game.Workspace:GetChildren()) do
if v:FindFirstChild("Humanoid") then
local hum = v:FindFirstChild("Humanoid")
local anim = hum:LoadAnimation(Snap)
anim:Play()
anim.Stopped:Connect(function()
hum:TakeDamage(100)
print(hum.Parent.Name.. " died.")
end)
end
end
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if (msg == "May you rest in peace.") then
Neck()
end
end)
end)
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if (msg == "May you rest in peace.") then
Neck()
end
end)
end)
well I tested it out and it worked, can you make a gif to show us what happen?
you also made 2 player.Chatted events with the same msg…
wait i may see the problem besides that
got it thanks <3 <3 <3 eeeeeeee