I’ve tried making some script which blocked any player movement while an animation is played, but apparently when the player dies, somewhy, the Controls get re-disabled. Does anyone know why?
local plr = game.Players.LocalPlayer
local char = plr.Character
local PlayerModule = require(plr.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
game.ReplicatedStorage.AnimationEvent.OnClientEvent:Connect(function(test_subject)
if char:FindFirstChild("IsPlayable") then
local animation = Instance.new("Animation")
local animation3 = Instance.new("Animation")
local hum = char:FindFirstChild("Humanoid")
animation.Parent = char
animation.AnimationId = "rbxassetid://IDHERE"
animation3.Parent = char
animation3.AnimationId = "rbxassetid://IDHERE"
local loadedTrack = hum:LoadAnimation(animation)
local loadedTrack3 = hum:LoadAnimation(animation3)
Controls:Disable()
loadedTrack:Play()
loadedTrack.Stopped:wait(loadedTrack.Length-.5)
loadedTrack3:Play()
loadedTrack3.Stopped:wait()
Controls:Enable()
end
end)
plr.CharacterAdded:Connect(function()
Controls:Enable()
end)