I have a kill script which is set up if you press K, it plays an animation and you die. When I published and tested the game, it only killed me. I don't understand why the animation isn't playing. Can anyone help?
Script:
local Player = game.Players.LocalPlayer local Character = Player.Character or script.Parent local Humanoid = Character.Humanoid local UserInputService = game:GetService("UserInputService") local AnimationId = 'rbxassetid://4506927840' local Debounce = true local Key = 'K' local noise = game.SoundService.Snap UserInputService.InputBegan:Connect(function(Input, IsTyping) if IsTyping then return end if Input.KeyCode == Enum.KeyCode[Key] and Debounce == true then Debounce = false local Animation = Instance.new("Animation") Animation.AnimationId = AnimationId local LoadAnimation = Humanoid:LoadAnimation(Animation) LoadAnimation:Play() wait(0.4) noise:Play() wait(0.2) LoadAnimation:Destroy() Humanoid.Health = 0 Debounce = true end end)
'rbxassetid://4506927840'
Above Needs to be Below
"rbxassetid://4506927840"
Try to read the wiki next time ;/ it's not that hard ;/
Probably the character dies before the animation load try to make the animation object with the ID outside the script and put them in starterCharacter then play it via the script
I found the solution. I forgot that the experimental mode no longer works. I shall now use Remote events to update the script so it can work again.