So I have a run service and it has a check inside of it I run this animation inside a module and return this check value true so the run will stop running here’s my module code:
local Dummy = game.Workspace.Rig
local humanoid = Dummy.Humanoid
local animation = humanoid.Animator:LoadAnimation(game.ReplicatedStorage.gameConfigurations.Animations.OffCouch)
local cam = workspace.CurrentCamera
local Couch = {}
function Couch:Play(animCheck)
wait()
animation:Play()
animation.Stopped:Wait()
cam.CameraType = Enum.CameraType.Custom
animCheck = true
return animCheck
end
return Couch
and here’s my local script code:
local plr = game.Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local cam = workspace.CurrentCamera
local camPart = game.Workspace.Rig.CameraBone
local dummy = game.Workspace.Rig
local run = game:GetService("RunService")
local animCheck = false
local animation = require(game.ReplicatedStorage.gameModules.GameStarting.CouchAnimation.CouchAnimation)
cam.CameraType = Enum.CameraType.Scriptable
run.RenderStepped:Connect(function()
if not animCheck then
cam.CFrame = camPart.CFrame
else
cam.CameraType = Enum.CameraType.Custom
cam.CameraType = Enum.CameraType.Custom
cam.CameraType = Enum.CameraType.Custom
end
end)
wait()
animation.Play(animCheck)
print(animCheck)
print(animCheck)
print(animCheck)
print(animCheck)
print(animCheck)
print(animCheck)
print(animCheck)
print(animCheck)