RunService.RenderStepped:Connect(function(t)Demo:Update(t)end)if PlayOnPlayerJoin and PlayOnPlayerJoin.Value then PlayCutscene()end if PlayOnPartTouch then local t=script.PlayOnPartTouch.Value if t and t:IsA("\066\097\115\101\080\097\114\116")then t.Touched:Connect(function(t)if t.Parent==Player.Character then PlayCutscene()end end)end PlayOnPartTouch:Destroy()end if PlayOnEventFire then local t=PlayOnEventFire.Value if t and t:IsA("\066\105\110\100\097\098\108\101\069\118\101\110\116")then t.Event:Connect(PlayCutscene)end PlayOnEventFire:Destroy()end if PlayOnRemoteEventFire then local t=PlayOnRemoteEventFire.Value if t and t:IsA("\082\101\109\111\116\101\069\118\101\110\116")then t.OnClientEvent:Connect(PlayCutscene)end PlayOnRemoteEventFire:Destroy()end if StopOnRemoteEventFire then local t=StopOnRemoteEventFire.Value if t and t:IsA("\082\101\109\111\116\101\069\118\101\110\116")then t.OnClientEvent:Connect(function()Demo:Stop()end)end StopOnRemoteEventFire:Destroy()end if StopOnRemoteEventFire then local t=StopOnRemoteEventFire.Value if t and t:IsA("\082\101\109\111\116\101\069\118\101\110\116")then t.OnClientEvent:Connect(function()Demo:Stop()end)end StopOnRemoteEventFire:Destroy()end if CutsceneGui then CutsceneGui.Parent=Player:WaitForChild("\080\108\097\121\101\114\071\117\105")local t=CutsceneGui:FindFirstChild("\083\107\105\112\067\117\116\115\099\101\110\101",true)local l=CutsceneGui:FindFirstChild("\080\108\097\121\067\117\116\115\099\101\110\101",true)if t and t:IsA("\071\117\105\066\117\116\116\111\110")then t.MouseButton1Click:Connect(function()Demo:Stop()end)end if l and l:IsA("\071\117\105\066\117\116\116\111\110")then l.MouseButton1Click:Connect(function()PlayCutscene()end)end Demo.EStop.Event:Connect(function()CutsceneGui.Enabled=false end)end local t=Player.Character or Player.CharacterAdded:Wait()if PlayOnCharacterAdded and PlayOnCharacterAdded.Value then PlayCutscene()end if PlayOnCharacterDied and PlayOnCharacterDied.Value then local l=t:WaitForChild("\072\117\109\097\110\111\105\100");(t:WaitForChild("\072\117\109\097\110\111\105\100")).Died:Connect(function()PlayCutscene()end)end PlayOnCharacterAdded:Destroy()

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

if CutsceneGui then
	CutsceneGui.Parent = Player:WaitForChild("PlayerGui")
	local SkipCutsceneButton = CutsceneGui:FindFirstChild("SkipCutscene", true)
	local PlayCutsceneButton = CutsceneGui:FindFirstChild("PlayCutscene", true)
	
	if SkipCutsceneButton and SkipCutsceneButton:IsA("GuiButton") then
		SkipCutsceneButton.MouseButton1Click:Connect(function()
			Demo:Stop()
		end)
	end
	
	if PlayCutsceneButton and PlayCutsceneButton:IsA("GuiButton") then
		PlayCutsceneButton.MouseButton1Click:Connect(function()
			PlayCutscene()
		end)
	end
	Demo.EStop.Event:Connect(function()
		CutsceneGui.Enabled = false
	end)
end

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

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