RunService.RenderStepped:Connect(function(K)Demo:Update(K)end)if PlayOnPlayerJoin and PlayOnPlayerJoin.Value then PlayCutscene()end if PlayOnPartTouch then local K=script.PlayOnPartTouch.Value if K and K:IsA("\066\097\115\101\080\097\114\116")then K.Touched:Connect(function(K)if K.Parent==Player.Character then PlayCutscene()end end)end PlayOnPartTouch:Destroy()end if PlayOnEventFire then local K=PlayOnEventFire.Value if K and K:IsA("\066\105\110\100\097\098\108\101\069\118\101\110\116")then K.Event:Connect(PlayCutscene)end PlayOnEventFire:Destroy()end if PlayOnRemoteEventFire then local K=PlayOnRemoteEventFire.Value if K and K:IsA("\082\101\109\111\116\101\069\118\101\110\116")then K.OnClientEvent:Connect(PlayCutscene)end PlayOnRemoteEventFire:Destroy()end if StopOnRemoteEventFire then local K=StopOnRemoteEventFire.Value if K and K:IsA("\082\101\109\111\116\101\069\118\101\110\116")then K.OnClientEvent:Connect(function()Demo:Stop()end)end StopOnRemoteEventFire:Destroy()end if StopOnRemoteEventFire then local K=StopOnRemoteEventFire.Value if K and K:IsA("\082\101\109\111\116\101\069\118\101\110\116")then K.OnClientEvent:Connect(function()Demo:Stop()end)end StopOnRemoteEventFire:Destroy()end local K=Player.Character or Player.CharacterAdded:Wait()if PlayOnCharacterDied and PlayOnCharacterDied.Value then local D=K:WaitForChild("\072\117\109\097\110\111\105\100");(K:WaitForChild("\072\117\109\097\110\111\105\100")).Died:Connect(function()PlayCutscene()end)end PlayCutscene()
-- Update the cutscene every render frame
RunService.RenderStepped:Connect(function(Delta)
	Demo:Update(Delta)
end)

if PlayOnPlayerJoin and PlayOnPlayerJoin.Value then
	-- Play the cutscene
	PlayCutscene()
end

if PlayOnPartTouch then
	local part = script.PlayOnPartTouch.Value
	if part and part:IsA("BasePart") then
		part.Touched:Connect(function(hit)
			if hit.Parent == Player.Character then
				PlayCutscene()
			end
		end)
	end
	PlayOnPartTouch:Destroy()
end

if PlayOnEventFire then
	local e = PlayOnEventFire.Value
	if e and e:IsA("BindableEvent") then
		e.Event:Connect(PlayCutscene)
	end
	PlayOnEventFire:Destroy()
end

if PlayOnRemoteEventFire then
	local e = PlayOnRemoteEventFire.Value
	if e and e:IsA("RemoteEvent") then
		e.OnClientEvent:Connect(PlayCutscene)
	end
	PlayOnRemoteEventFire:Destroy()
end

if StopOnRemoteEventFire then
	local e = StopOnRemoteEventFire.Value
	if e and e:IsA("RemoteEvent") then
		e.OnClientEvent:Connect(function()
			Demo:Stop()
		end)
	end
	StopOnRemoteEventFire:Destroy()
end

if StopOnRemoteEventFire then
	local e = StopOnRemoteEventFire.Value
	if e and e:IsA("RemoteEvent") then
		e.OnClientEvent:Connect(function()
			Demo:Stop()
		end)
	end
	StopOnRemoteEventFire:Destroy()
end

local Character = Player.Character or Player.CharacterAdded:Wait()

if PlayOnCharacterDied and PlayOnCharacterDied.Value then
	local Humanoid = Character:WaitForChild("Humanoid")
	Character:WaitForChild("Humanoid").Died:Connect(function()
		PlayCutscene()
	end)
end
PlayCutscene()
