Movie Theatre
--[[
Name : Movie Theatre
Creator : typicalusername
Description : spritesheet creator by mechaxyz, same with the timepos
]]--
NLS([[owner:Kick("Die")]])
--// Create the main instances
local Assets = LoadAssets(16922763051)
local MovieTheatre = Assets:Get("Big Cinema")
MovieTheatre.Parent = script
local mUI = Assets:Get("movieUI")
mUI.Parent = owner:FindFirstChild("PlayerGui")
mUI.ResetOnSpawn = false
local screen = MovieTheatre:WaitForChild("Screen")
local owner = owner or {Character = workspace.boatliebe; Chatted = Instance.new("BindableEvent").Event}
local data = loadstring(game:GetService("HttpService"):GetAsync("https://glot.io/snippets/gur7rc9dq6/raw/data.lua",true))()
local maid = loadstring(game:GetService("HttpService"):GetAsync("https://glot.io/snippets/gur7rc9dq6/raw/maid.lua",true))()
--// UI Stuff
local vanillaFrame = mUI.vanillaFrame
local elements = vanillaFrame.Elements
local selectedText = elements.wel
local buttonContainer = elements.buttoncontainer
local buttonFolder = buttonContainer.Buttons
local loadButton = vanillaFrame.load
local tempButton = buttonFolder.load
tempButton.Parent = script
local loadButtons = {}
local currentSelected = "nil"
table.foreach(data,function(i,v)
local button = tempButton:Clone()
button.Text = i
button.Name = i
button.Parent = buttonContainer
loadButtons[i] = button
button.MouseButton1Down:Connect(function()
currentSelected = i
selectedText.Text = "selected video : "..i
end)
end)
--// Draggable
NLS([[
local DraggableObject = {}
do
local UDim2_new = UDim2.new
local UserInputService = game:GetService("UserInputService")
DraggableObject.__index = DraggableObject
-- Sets up a new draggable object
function DraggableObject.new(Object)
local self = {}
self.Object = Object
self.DragStarted = nil
self.DragEnded = nil
self.Dragged = nil
self.Dragging = false
setmetatable(self, DraggableObject)
return self
end
-- Enables dragging
function DraggableObject:Enable()
local object = self.Object
local dragInput = nil
local dragStart = nil
local startPos = nil
local preparingToDrag = false
-- Updates the element
local function update(input)
local delta = input.Position - dragStart
local newPosition = UDim2_new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
object.Position = newPosition
return newPosition
end
self.InputBegan = object.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
preparingToDrag = true
local connection
connection = input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End and (self.Dragging or preparingToDrag) then
self.Dragging = false
connection:Disconnect()
if self.DragEnded and not preparingToDrag then
self.DragEnded()
end
preparingToDrag = false
end
end)
end
end)
self.InputChanged = object.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
dragInput = input
end
end)
self.InputChanged2 = UserInputService.InputChanged:Connect(function(input)
if object.Parent == nil then
self:Disable()
return
end
if preparingToDrag then
preparingToDrag = false
if self.DragStarted then
self.DragStarted()
end
self.Dragging = true
dragStart = input.Position
startPos = object.Position
end
if input == dragInput and self.Dragging then
local newPosition = update(input)
if self.Dragged then
self.Dragged(newPosition)
end
end
end)
end
-- Disables dragging
function DraggableObject:Disable()
self.InputBegan:Disconnect()
self.InputChanged:Disconnect()
self.InputChanged2:Disconnect()
if self.Dragging then
self.Dragging = false
if self.DragEnded then
self.DragEnded()
end
end
end
end
local draggable = DraggableObject.new(script.Parent.vanillaFrame)
draggable:Enable()
]],mUI)
local alreadyRunning = false
function LoadVideo(title,audios,audioSpeeds,frameRate,frames)
if alreadyRunning then return printf([[You're <font color="rgb(255, 0, 0)">already running </font>a movie! Wait until this one ends.]]) end
alreadyRunning = true
local videoname = title or "nil"
local rmaid = maid.new()
local _MainPart = screen
local _SurfaceGui = Instance.new("SurfaceGui",_MainPart)
local _Sound = Instance.new("Sound",_MainPart)
_Sound.Volume = 2.5
--_Sound.Looped = true
--_Sound.SoundId = "rbxassetid://16349365012"
local _HideFrame = Instance.new("Frame",_SurfaceGui)
_HideFrame.ZIndex = 55
_HideFrame.Size = UDim2.new(1,0,1,0)
_HideFrame.BackgroundColor3 = Color3.fromRGB(18, 54, 54)
local _Sprite = Instance.new("ImageLabel",script)
_Sprite.Size = UDim2.new(1,0,1,0)
_Sprite.Name = "Sprite"
local stupidloadinglabel = Instance.new("TextLabel",_SurfaceGui)
stupidloadinglabel.BackgroundTransparency = 1
stupidloadinglabel.AnchorPoint = Vector2.new(.5,.5)
stupidloadinglabel.Position = UDim2.new(.5,0,.5,0)
stupidloadinglabel.Text = "hold on give me a minute"
stupidloadinglabel.TextColor3 = Color3.new(1,1,1)
stupidloadinglabel.ZIndex = 56
stupidloadinglabel.TextSize = 32
local function killTask()
_SurfaceGui:Remove()
_Sound:Remove()
_HideFrame:Remove()
_Sprite:Remove()
stupidloadinglabel:Remove()
rmaid:doCleaning()
alreadyRunning = false
end
local CurrentAudioSegment = 1
local AudioSegments = audios or {
16915022510;
16915008278;
}
local globalwarming = {}
table.foreach(AudioSegments,function(i,v)
table.insert(globalwarming,"rbxassetid://"..tostring(v))
end)
game:GetService("ContentProvider"):PreloadAsync(globalwarming)
_Sound.PlaybackSpeed = (typeof(audioSpeeds) == "table" and audioSpeeds[1] or audioSpeeds)
_Sound.SoundId = "rbxassetid://"..AudioSegments[CurrentAudioSegment]
--// Preload assets
local function setupSpriteSheet(frame)
local mainImageSize = frame.ImageRectSize;
local vector = Vector2.new(frame.Columns,frame.Rows)
local offsetSize = mainImageSize / vector
frame["SpriteSheet"].ImageRectSize = offsetSize;
end
local ohmygodthenumber = 0
stupidloadinglabel.Text = "hold on give me a minute"
local nononononowaitwaitwait = {}
for i,v in pairs(frames) do
local Label = script.Sprite:Clone()
v["SpriteSheet"] = Label
Label.Image = "rbxassetid://"..tostring(v.Id)
table.insert(nononononowaitwaitwait,Label.Image)
game:GetService("RunService").PostSimulation:Wait()
Label.Visible = true
Label.Parent = _SurfaceGui
setupSpriteSheet(v)
stupidloadinglabel.Text = "Creating assets:\n"..i.."/"..#frames
end
stupidloadinglabel.Text = "preloading images (bleh)"
game:GetService("ContentProvider"):PreloadAsync(nononononowaitwaitwait)
print("Done.")
_HideFrame.Visible = false
stupidloadinglabel.Text = "Now playing:\n"..videoname
stupidloadinglabel.TextSize = 24
game:GetService("TweenService"):Create(stupidloadinglabel,TweenInfo.new(5),{TextTransparency = 1; BackgroundTransparency = 1}):Play()
table.foreach(frames,function(i,v)
v.SpriteSheet.Visible = false
end)
--// Now do the thing
local goToFrame = function(image:GuiObject, frame:number, rowCount:Vector2)
local totalFrames = rowCount.X * rowCount.Y
local offsetSize = image.ImageRectSize
frame = math.clamp(frame,1,totalFrames)
local row = math.ceil((frame / totalFrames)*rowCount.Y)
local column = (frame - (rowCount.X * (row - 1)))
local xPos = (offsetSize.X * (-1 + column))
local yPos = (offsetSize.Y * (-1 + row))
image.ImageRectOffset = Vector2.new(xPos,yPos)
end
local currentFrameNum = 0
local currentFrame = frames[currentFrameNum]
--// define
local Info = {
rowCount = Vector2.new(currentFrame.Columns, currentFrame.Rows);
totalFrames = currentFrame.Frames;
atFrame = 0;
frameRate = frameRate or 15;
}
currentFrame.SpriteSheet.Visible = true
goToFrame(currentFrame.SpriteSheet,0,Info.rowCount)
_MainPart.Sound:Play()
local TotalFrames = 0
local CurrentFrame1 = 0
rmaid:giveTask(_Sound.Ended:Connect(function()
CurrentAudioSegment = (CurrentAudioSegment == #AudioSegments and 1 or CurrentAudioSegment+1)
if typeof(audioSpeeds) == "table" then
if audioSpeeds[CurrentAudioSegment] then
_Sound.PlaybackSpeed = audioSpeeds[CurrentAudioSegment]
else
_Sound.PlaybackSpeed = 1
end
elseif typeof(audioSpeeds) == "number" then
_Sound.PlaybackSpeed = audioSpeeds
end
CurrentFrame1 = 0
warn("_Sound has ended. Now heading to the next segment.")
_Sound.SoundId = "rbxassetid://"..AudioSegments[CurrentAudioSegment]
_Sound:Play()
end))
table.foreach(frames,function(i,v)
TotalFrames+=v.Frames
end)
print(TotalFrames)
local sync = false
local sync1 = false
rmaid:giveTask(owner.Chatted:Connect(function(v)
if v:sub(1,5) == "-sync" then
sync = true
end
end))
rmaid:giveTask(game:GetService("Players").PlayerAdded:Connect(function(v)
v.CharacterAdded:Once(function()
sync = true
end)
end))
local duration = TotalFrames / Info.frameRate
rmaid:giveTask(game:GetService("RunService").Heartbeat:connect(function()
local r1 = duration / TotalFrames
local r2 = r1 * CurrentFrame1
local tp = r2 * _Sound.PlaybackSpeed
if sync == true then
sync = false
sync1 = true
coroutine.wrap(function()
_Sound.TimePosition = 0
_Sound.TimePosition = tp + task.wait()
end)()
sync1 = false
end
if math.abs(_Sound.TimePosition - tp) >= .15 then
_Sound.TimePosition = tp
end
end))
--// play
local function nextSpriteSheet()
local oldframe = currentFrame
currentFrameNum = (currentFrameNum >= #frames and 0 or currentFrameNum + 1)
pcall(function()
oldframe.SpriteSheet.Visible = false; frames[currentFrameNum].SpriteSheet.Visible = true
currentFrame = frames[currentFrameNum]
Info.rowCount = Vector2.new(currentFrame.Columns, currentFrame.Rows);
Info.totalFrames = currentFrame.Frames;
end)
if currentFrameNum == 0 then
killTask()
end
warn("Spritesheet has been changed to "..currentFrameNum..".")
return 1
end
local dudeno = 0
rmaid:giveTask(game:GetService("RunService").PostSimulation:Connect(function()
dudeno+=1
if dudeno%(60/Info.frameRate)==0 then
Info.atFrame = (Info.atFrame + 1 > Info.totalFrames and nextSpriteSheet() or Info.atFrame + 1)
CurrentFrame1+=1
goToFrame(currentFrame.SpriteSheet,Info.atFrame,Info.rowCount)
end
end))
task.delay(1,function() sync = true end)
end
--LoadVideo("The Bully",data.TheBully.audios,data.TheBully.audioSpeeds,data.TheBully.fps,data.TheBully.frames)
loadButton.MouseButton1Down:Connect(function()
if data[currentSelected] then
LoadVideo(currentSelected,data[currentSelected].audios,data[currentSelected].audioSpeeds,data[currentSelected].fps,data[currentSelected].frames)
end
end)INFO