-
What do you want to achieve?
Prevent respawn animation from playing the first time player join and only play if the player has died once -
What is the issue?
Player still Play the respawn animation after they joined I have tried using a tag but I have no knowledge of how to keep player’s tag after they respawn -
What solutions have you tried so far?
I tried using collectiveservice to give player a tag with .Died event but tag got reset after they respawn
Humanoid.Died:Connect(function()
dash:Destroy()
local Ouch = script.soundeffect:WaitForChild("ouch")
Ouch:Play()
Highlight:Destroy()
local colorEffect = Instance.new("ColorCorrectionEffect", game.Lighting)
colorEffect.TintColor = Color3.new(1,0,0)
camShake:Shake(CameraShaker.Presets.Bump)
wait(.1)
colorEffect:Destroy()
local CollectionService = game:GetService("CollectionService")
local obj = script.Parent
CollectionService:AddTag(obj,"Died")
end)
This is localscript for checking if player died
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
wait(1)
local Humanoid = Character:FindFirstChild("Humanoid")
local Highlight = Instance.new("Highlight", Character)
Highlight.FillColor = Color3.fromRGB(255, 0, 0)
Highlight.OutlineColor = Color3.fromRGB(255, 255, 255)
Highlight.FillTransparency = .5
Highlight.Enabled = false
if Character:HasTag("Died") then
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/asset/?id=127917966861716"
local animationTrack = Humanoid:LoadAnimation(animation)
animationTrack:Play()
animationTrack:GetMarkerReachedSignal("Glowing"):Connect(function(paramString)
Highlight.Enabled = true
end)
animationTrack:GetMarkerReachedSignal("StopGlowing"):Connect(function(paramString)
Highlight:Destroy()
end)
end
task.wait()
end)
end)
this is respawn script
I’m still new to lua coding so if you could please explain what the solution is and what the said funtion do, thank you