Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local spart = Instance.new("Part")
- spart.Parent = script
- spart.CFrame = CFrame.new(1.15006196, 7.37997007, -0.665921986, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- spart.Orientation = Vector3.new(0, 180, 0)
- spart.Color = Color3.new(0.972549, 0.972549, 0.972549)
- spart.Size = Vector3.new(26.2399158, 14.7599401, 0.151851237)
- spart.Material = Enum.Material.SmoothPlastic
- spart.Anchored = true
- spart.Locked = false
- spart.CanCollide = true
- local plr = owner
- -- https://jacklehamster.github.io/utils/gif2sprite/
- local gifs = {
- ['sonic'] = {
- image_id = 5159161618,
- rows = 13,
- columns = 7,
- fps = 10,
- frames = 89,
- full60fps = false,
- },
- ['rickroll'] = {
- image_id = 5159003271,
- rows = 7,
- columns = 5,
- fps = 15,
- frames = 31,
- full60fps = false,
- },
- ['social'] = {
- image_id = 5159174648,
- rows = 5,
- columns = 5,
- fps = 30,
- frames = 25,
- full60fps = false,
- },
- }
- local image = Instance.new("Texture")
- image.Face = "Front"
- image.Parent = spart
- local currentFrame = 1
- local currentRow,CurrentColumn = 0,0
- local linear = false
- local rows,columns = 0,0
- local fps = 1
- local frames = 0
- local full60fps = true
- local size = spart.Size
- function setup_gif(id)
- local gif = gifs[id]
- if gif then else return end
- rows = gif.rows
- columns = gif.columns
- currentRow,CurrentColumn,currentFrame = 1,1,1
- full60fps = gif.full60fps
- fps = gif.fps
- frames = gif.frames
- image.Texture = 'rbxassetid://' .. gif.image_id
- image.StudsPerTileU = columns*size.X
- image.StudsPerTileV = rows*size.Y
- end
- setup_gif('rickroll')
- plr.Chatted:Connect(function(msg)
- if msg:lower():sub(1,4) == 'gif/' then
- local id = msg:lower():sub(5)
- setup_gif(id)
- elseif msg:lower():sub(1,7) == '/e gif/' then
- local id = msg:lower():sub(8)
- setup_gif(id)
- end
- end)
- while true do
- if not full60fps then wait(1/fps) else game:GetService("RunService").Stepped:Wait() end
- if linear then
- image.OffsetStudsU = image.OffsetStudsU + size.X
- if image.OffsetStudsU > image.StudsPerTileU then
- image.OffsetStudsU = 0
- end
- else
- CurrentColumn = CurrentColumn + 1
- if CurrentColumn > columns then
- CurrentColumn = 1
- currentRow = currentRow + 1
- end
- if currentFrame > frames then
- currentRow,CurrentColumn,currentFrame = 1,1,1
- end
- image.OffsetStudsU = size.X*(CurrentColumn-1)
- image.OffsetStudsV = size.Y*(currentRow-1)
- currentFrame = currentFrame+1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement