im asking this because i have a script whose animation doesn’t work as it should
local LoadedAnimations = {}
local function CreatePrompt(Character)
local torso = Character:WaitForChild("Torso")
local hum = Character:WaitForChild("Humanoid")
local prox = Instance.new("ProximityPrompt", torso)
prox.ActionText = "Womp Womp"
prox.ObjectText = "Womp Womp Him Until He Dies !"
prox.Triggered:Connect(function(PlayerWhoTriggered)
local Animation = LoadedAnimations[PlayerWhoTriggered];
if (not Animation) then
LoadedAnimations[PlayerWhoTriggered] = PlayerWhoTriggered.Character.Humanoid:LoadAnimation(script.Animation) --// bad practice, avoid at all costs
Animation = LoadedAnimations[PlayerWhoTriggered];
end
Animation:Play();
task.wait(1)
hum.Health = 0
end)
end
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
CreatePrompt(Character)
end)
end)
for _, Player in ipairs(game.Players:GetPlayers()) do
local Character = Player.Character or Player.CharacterAdded:Wait()
CreatePrompt(Character)
Player.CharacterAdded:Connect(CreatePrompt)
end