--https://glot.io/snippets/gtu6iy0i8a
local HTTPS = game:GetService("HttpService")
local DSS = game:GetService("DataStoreService")
local DataStore = DSS:GetDataStore("InfiniteCraft")
local Player = owner
function HttpGet(URL, JSON)
local Raw = HTTPS:GetAsync(URL)
if JSON then
Raw = HTTPS:JSONDecode(Raw)
end
return Raw
end
local Size = 11
local RESOLUTION = "1920x1080"
RESOLUTION = RESOLUTION:split("x")
local Part = Instance.new("Part")
Part.Size = Vector3.new(Size * (RESOLUTION[1] / RESOLUTION[2]), Size, 0)
Part.Color = Color3.new()
Part.CanCollide = false
Part.CanTouch = false
Part.CastShadow = false
Part.Name = "Base"
Part.Parent = script
local Attachment = Instance.new("Attachment", Part)
local LinearVelocity = Instance.new("LinearVelocity")
LinearVelocity.MaxForce = math.huge
LinearVelocity.Attachment0 = Attachment
LinearVelocity.Parent = Attachment
Part:SetNetworkOwner(Player)
local Remote = Instance.new("RemoteEvent", Part)
local SurfaceUI = Instance.new("SurfaceGui")
SurfaceUI.LightInfluence = 0
SurfaceUI.ClipsDescendants = true
SurfaceUI.Brightness = 1
SurfaceUI.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
SurfaceUI.PixelsPerStud = 100
SurfaceUI.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
SurfaceUI.Parent = Part
local InputFrame = Instance.new("Frame")
InputFrame.BackgroundTransparency = 1
InputFrame.Size = UDim2.fromScale(1, 1)
InputFrame.ZIndex = 1000000
InputFrame.Parent = SurfaceUI
local Persist = Instance.new("ScreenGui", Player.PlayerGui)
Persist.ResetOnSpawn = false
do
-- Update check
local SelfLink = "https://glot.io/snippets/gtu6iy0i8a"
local ThisSource = HttpGet(SelfLink)
task.spawn(function()
while true do
local Raw = HttpGet(SelfLink)
if Raw ~= ThisSource then
Remote:FireAllClients("Notify", {
Title = "Infinite Craft",
Text = "This script has been updated! Please re-run!",
Button1 = "Okay"
})
task.wait(1)
script:Destroy()
break
end
task.wait(4)
end
end)
end
local Client = NLS([[local Part = script:WaitForChild("Value").Value
local Remote = Part.RemoteEvent
Remote.OnClientEvent:Connect(function(Name, Data)
if Name == "Notify" then
game:GetService("StarterGui"):SetCore("SendNotification", Data)
end
end)
function Check(v)
if v:GetAttribute("HideOnClient") then
v.Visible = false
end
if v:GetAttribute("Events") then
v.Active = true
v.Visible = true
for _, Event in next, v:GetAttribute("Events"):split(",") do
if Event:sub(1, 11) == "PropChange_" then
v:GetPropertyChangedSignal(Event:sub(12)):Connect(function()
Remote:FireServer(v, Event, v[Event:sub(12)])
end)
else
v[Event]:Connect(function(...)
local Args = {...}
for Index, Value in next, Args do
if typeof(Value) == "Instance" and Value:IsA("InputObject") then
Args[Index] = {
KeyCode = Value.KeyCode,
UserInputType = Value.UserInputType,
}
end
end
Remote:FireServer(v, Event, unpack(Args))
end)
end
end
end
if v:GetAttribute("DontMoveThisFrameLmao") then
v:GetPropertyChangedSignal("Position"):Connect(function()
v.Position = UDim2.new()
end)
end
end
Part.DescendantAdded:Connect(function(v)
Check(v)
v.AttributeChanged:Connect(function()
Check(v)
end)
end)
for i, v in next, Part:GetDescendants() do
Check(v)
v.AttributeChanged:Connect(function()
Check(v)
end)
end
while true do
local dt = task.wait()
local c = owner.Character
if c then
local r = c:FindFirstChild("HumanoidRootPart")
if r then
Part.CFrame = Part.CFrame:Lerp(r.CFrame * CFrame.new(0, Part.Size.Y/2 + 1, -7) * CFrame.Angles(math.rad(10), math.pi, 0),1 - (0.0000001 ^ dt))
end
end
end]], Persist)
Instance.new("ObjectValue", Client).Value = Part
-- UI CREATION
local root = Instance.new("Frame")
root.Name = "Root"
root.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
root.BorderColor3 = Color3.fromRGB(0, 0, 0)
root.BorderSizePixel = 0
root.Size = UDim2.fromScale(1, 1)
local side = Instance.new("Frame")
side.Name = "Side"
side.AnchorPoint = Vector2.new(1, 0)
side.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
side.BorderColor3 = Color3.fromRGB(203, 203, 203)
side.Position = UDim2.fromScale(1, 0)
side.Size = UDim2.fromScale(0.24, 1)
local title = Instance.new("TextLabel")
title.Name = "Title"
title.FontFace = Font.new(
"rbxasset://fonts/families/RobotoCondensed.json",
Enum.FontWeight.Light,
Enum.FontStyle.Normal
)
title.LineHeight = 0.8
title.RichText = true
title.Text = "|nfinite<br/><font weight=\"regular\">Craft</font>"
title.TextColor3 = Color3.fromRGB(0, 0, 0)
title.TextScaled = true
title.TextSize = 14
title.TextWrapped = true
title.TextXAlignment = Enum.TextXAlignment.Right
title.AnchorPoint = Vector2.new(1, 0)
title.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
title.BackgroundTransparency = 1
title.BorderColor3 = Color3.fromRGB(0, 0, 0)
title.BorderSizePixel = 0
title.Position = UDim2.fromOffset(-10, 5)
title.Size = UDim2.fromScale(0.322, 0.125)
local uIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
uIAspectRatioConstraint.Name = "UIAspectRatioConstraint"
uIAspectRatioConstraint.AspectRatio = 1.2
uIAspectRatioConstraint.Parent = title
title.Parent = side
local scroll = Instance.new("ScrollingFrame")
scroll.Name = "Scroll"
scroll.ScrollBarImageColor3 = Color3.fromRGB(184, 184, 184)
scroll.ScrollBarThickness = 0
scroll.Active = true
scroll.CanvasSize = UDim2.new()
scroll.AnchorPoint = Vector2.new(0.5, 0.5)
scroll.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
scroll.BorderColor3 = Color3.fromRGB(0, 0, 0)
scroll.BorderSizePixel = 0
scroll.Position = UDim2.fromScale(0.5, 0.45)
scroll.AutomaticCanvasSize = Enum.AutomaticSize.Y
scroll.Size = UDim2.new(1, -17 * 2, 0.9, -20 * 2)
local scrollInner = Instance.new("Frame")
scrollInner.BackgroundTransparency = 1
scrollInner.Size = UDim2.fromScale(1, 1)
scrollInner.Parent = scroll
local uIPadding = Instance.new("UIPadding")
uIPadding.Name = "UIPadding"
uIPadding.PaddingBottom = UDim.new(0, 1)
uIPadding.PaddingLeft = UDim.new(0, 1)
uIPadding.PaddingRight = UDim.new(0, 1)
uIPadding.PaddingTop = UDim.new(0, 1)
uIPadding.Parent = scrollInner
local scrollList = Instance.new("UIListLayout")
scrollList.Padding = UDim.new(0, 20)
scrollList.SortOrder = Enum.SortOrder.LayoutOrder
scrollList.Parent = scrollInner
scroll.Parent = side
local searchBar = Instance.new("Frame")
searchBar.Name = "SearchBar"
searchBar.AnchorPoint = Vector2.new(0, 1)
searchBar.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
searchBar.BorderColor3 = Color3.fromRGB(203, 203, 203)
searchBar.Position = UDim2.fromScale(0, 1)
searchBar.Size = UDim2.fromScale(1, 0.06)
local searchIcon = Instance.new("ImageLabel")
searchIcon.Name = "SearchIcon"
searchIcon.Image = "rbxassetid://5492253050"
searchIcon.ImageColor3 = Color3.fromRGB(203, 203, 203)
searchIcon.ScaleType = Enum.ScaleType.Fit
searchIcon.AnchorPoint = Vector2.new(0, 0.5)
searchIcon.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
searchIcon.BackgroundTransparency = 1
searchIcon.BorderColor3 = Color3.fromRGB(0, 0, 0)
searchIcon.BorderSizePixel = 0
searchIcon.Position = UDim2.new(0, 10, 0.5, 0)
searchIcon.Size = UDim2.fromScale(0.08, 0.55)
searchIcon.Parent = searchBar
local searchBox = Instance.new("TextBox")
searchBox.Name = "SearchBox"
searchBox.FontFace = Font.new("rbxasset://fonts/families/Roboto.json")
searchBox.PlaceholderColor3 = Color3.fromRGB(153, 153, 153)
searchBox.PlaceholderText = "Search here..."
searchBox.Text = ""
searchBox.TextColor3 = Color3.fromRGB(0, 0, 0)
searchBox.TextScaled = true
searchBox.TextSize = 14
searchBox.TextWrapped = true
searchBox.TextXAlignment = Enum.TextXAlignment.Left
searchBox.AnchorPoint = Vector2.new(0, 0.5)
searchBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
searchBox.BackgroundTransparency = 1
searchBox.BorderColor3 = Color3.fromRGB(0, 0, 0)
searchBox.BorderSizePixel = 0
searchBox.Position = UDim2.fromScale(0.146, 0.5)
searchBox.Size = UDim2.fromScale(0.854, 0.5)
searchBox.Parent = searchBar
searchBar.Parent = side
local discoveriesButton = Instance.new("Frame")
discoveriesButton.Name = "DiscoveriesButton"
discoveriesButton.AnchorPoint = Vector2.new(0, 1)
discoveriesButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
discoveriesButton.BorderColor3 = Color3.fromRGB(203, 203, 203)
discoveriesButton.Position = UDim2.fromScale(0, 0.939)
discoveriesButton.Size = UDim2.fromScale(0.5, 0.04)
local discoveriesButtonText = Instance.new("TextLabel")
discoveriesButtonText.Name = "DiscoveriesButtonText"
discoveriesButtonText.FontFace = Font.new("rbxasset://fonts/families/Roboto.json")
discoveriesButtonText.LineHeight = 0.8
discoveriesButtonText.RichText = true
discoveriesButtonText.Text = "✨ Discoveries"
discoveriesButtonText.TextColor3 = Color3.fromRGB(0, 0, 0)
discoveriesButtonText.TextScaled = true
discoveriesButtonText.TextSize = 14
discoveriesButtonText.TextWrapped = true
discoveriesButtonText.AnchorPoint = Vector2.new(0, 0.5)
discoveriesButtonText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
discoveriesButtonText.BackgroundTransparency = 1
discoveriesButtonText.BorderColor3 = Color3.fromRGB(0, 0, 0)
discoveriesButtonText.BorderSizePixel = 0
discoveriesButtonText.Position = UDim2.fromScale(0, 0.5)
discoveriesButtonText.Size = UDim2.fromScale(1, 0.55)
local uIGradient = Instance.new("UIGradient")
uIGradient.Name = "UIGradient"
uIGradient.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(0, 0, 0)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 0, 0)),
})
uIGradient.Parent = discoveriesButtonText
discoveriesButtonText.Parent = discoveriesButton
discoveriesButton.Parent = side
local sortByButton = Instance.new("Frame")
sortByButton.Name = "SortByButton"
sortByButton.AnchorPoint = Vector2.new(0, 1)
sortByButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
sortByButton.BorderColor3 = Color3.fromRGB(203, 203, 203)
sortByButton.Position = UDim2.fromScale(0.5, 0.939)
sortByButton.Size = UDim2.fromScale(0.5, 0.04)
local sortByButtonText = Instance.new("TextLabel")
sortByButtonText.Name = "SortByButtonText"
sortByButtonText.FontFace = Font.new("rbxasset://fonts/families/Roboto.json")
sortByButtonText.LineHeight = 0.8
sortByButtonText.RichText = true
sortByButtonText.Text = "⌛ Sort by time"
sortByButtonText.TextColor3 = Color3.fromRGB(0, 0, 0)
sortByButtonText.TextScaled = true
sortByButtonText.TextSize = 14
sortByButtonText.TextWrapped = true
sortByButtonText.AnchorPoint = Vector2.new(0, 0.5)
sortByButtonText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
sortByButtonText.BackgroundTransparency = 1
sortByButtonText.BorderColor3 = Color3.fromRGB(0, 0, 0)
sortByButtonText.BorderSizePixel = 0
sortByButtonText.Position = UDim2.fromScale(0, 0.5)
sortByButtonText.Size = UDim2.fromScale(1, 0.55)
local uIGradient1 = Instance.new("UIGradient")
uIGradient1.Name = "UIGradient"
uIGradient1.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(0, 0, 0)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 0, 0)),
})
uIGradient1.Parent = sortByButtonText
sortByButtonText.Parent = sortByButton
sortByButton.Parent = side
side.Parent = root
local lSB_Logo = Instance.new("ImageLabel")
lSB_Logo.Name = "LSB_Logo"
lSB_Logo.Image = "http://www.roblox.com/asset/?id=16536705558"
lSB_Logo.ImageTransparency = 0.5
lSB_Logo.ScaleType = Enum.ScaleType.Fit
lSB_Logo.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
lSB_Logo.BackgroundTransparency = 1
lSB_Logo.BorderColor3 = Color3.fromRGB(0, 0, 0)
lSB_Logo.BorderSizePixel = 0
lSB_Logo.Position = UDim2.fromOffset(5, 5)
lSB_Logo.Size = UDim2.fromScale(0.0344, 0.0835)
local uIAspectRatioConstraint1 = Instance.new("UIAspectRatioConstraint")
uIAspectRatioConstraint1.Name = "UIAspectRatioConstraint"
uIAspectRatioConstraint1.Parent = lSB_Logo
lSB_Logo.Parent = root
local item = Instance.new("Frame")
item.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
item.BorderColor3 = Color3.fromRGB(0, 0, 0)
item.BorderSizePixel = 0
LastItemTab = item
Instance.new("UIScale", item)
local ItemFontSize = 18
local uICorner = Instance.new("UICorner")
uICorner.Name = "UICorner"
uICorner.CornerRadius = UDim.new(0, 4)
uICorner.Parent = item
local uIStroke = Instance.new("UIStroke")
uIStroke.Name = "UIStroke"
uIStroke.Color = Color3.fromRGB(203, 203, 203)
uIStroke.Parent = item
local text = Instance.new("TextLabel")
text.Name = "Text"
text.FontFace = Font.new(
"rbxasset://fonts/families/SourceSansPro.json",
Enum.FontWeight.SemiBold,
Enum.FontStyle.Normal
)
text.TextColor3 = Color3.fromRGB(0, 0, 0)
text.TextSize = ItemFontSize
text.TextXAlignment = Enum.TextXAlignment.Left
text.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
text.BackgroundTransparency = 1
text.BorderColor3 = Color3.fromRGB(0, 0, 0)
text.BorderSizePixel = 0
text.Position = UDim2.fromOffset(30, 0)
text.Size = UDim2.new(1, -30, 0, 30)
text.Parent = item
local imageIcon = Instance.new("ImageLabel")
imageIcon.Name = "ImageIcon"
imageIcon.ScaleType = Enum.ScaleType.Fit
imageIcon.AnchorPoint = Vector2.new(0, 0.5)
imageIcon.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
imageIcon.BackgroundTransparency = 1
imageIcon.BorderColor3 = Color3.fromRGB(0, 0, 0)
imageIcon.BorderSizePixel = 0
imageIcon.Position = UDim2.fromScale(0, 0.5)
imageIcon.Size = UDim2.fromOffset(30, ItemFontSize)
imageIcon.Parent = item
local uIGradient = Instance.new("UIGradient")
uIGradient.Name = "UIGradient"
uIGradient.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(120, 210, 220):Lerp(Color3.new(1, 1, 1), 0.6)),
})
uIGradient.Rotation = 90
uIGradient.Enabled = false
uIGradient.Parent = item
local elementCount = Instance.new("TextLabel")
elementCount.Name = "ElementCount"
elementCount.FontFace = Font.new("rbxasset://fonts/families/SourceSansPro.json")
elementCount.RichText = true
elementCount.Text = "Elements: 0"
elementCount.TextColor3 = Color3.fromRGB(0, 0, 0)
elementCount.TextScaled = true
elementCount.TextSize = 14
elementCount.TextTransparency = 0.5
elementCount.TextWrapped = true
elementCount.TextXAlignment = Enum.TextXAlignment.Right
elementCount.AnchorPoint = Vector2.new(1, 0)
elementCount.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
elementCount.BackgroundTransparency = 1
elementCount.BorderColor3 = Color3.fromRGB(0, 0, 0)
elementCount.BorderSizePixel = 0
elementCount.Position = UDim2.new(0, -9, 0.133, 0)
elementCount.Size = UDim2.fromScale(0.335, 0.0275)
elementCount.Parent = side
-- MAIN
root.Parent = SurfaceUI
for _, Object in root:GetDescendants() do
if Object:IsA("Frame") then
Object.BorderSizePixel *= 2
end
end
do
local InputEvents = {}
function AddInputEvents(Object, Events)
local EventNames = {}
for Name in Events do
table.insert(EventNames, Name)
end
Object:SetAttribute("Events", table.concat(EventNames, ","))
InputEvents[Object] = Events
end
Remote.OnServerEvent:Connect(function(Sender, Object, Event, ...)
if Sender ~= Player then return end
local Events = InputEvents[Object]
if Events then
local Callback = Events[Event]
if Callback then
Callback(Object, ...)
end
end
end)
end
local ItemTabScale = 1.7
local CurrentItemTabSegment = Instance.new("Frame")
CurrentItemTabSegment.Size = UDim2.fromScale(1, 0) + UDim2.fromOffset(0, 30)
CurrentItemTabSegment.BackgroundTransparency = 1
CurrentItemTabSegment.BackgroundColor3 = Color3.new(1, 1, 0)
CurrentItemTabSegment.Parent = scrollInner
local List = Instance.new("UIListLayout", CurrentItemTabSegment)
List.Padding = UDim.new(0, 20)
List.FillDirection = Enum.FillDirection.Horizontal
Instance.new("UIScale", CurrentItemTabSegment).Scale = ItemTabScale
local CurrentItemTabSegmentItems = 0
local IsDragging = false
local LastItemTab
local MouseX, MouseY = 0, 0
local TWS = game:GetService("TweenService")
local DSS = game:GetService("DataStoreService")
AddInputEvents(InputFrame, {
MouseMoved = function(_, X, Y)
MouseX = X
MouseY = Y
end,
InputEnded = function(_, Input)
if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
IsDragging = false
end
end,
})
local Sounds = {
instance = 16568819557,
delete = 16568857935,
discovery = 16568861305,
reward = 16568870856,
error = 16568873929,
}
do
scroll.Active = false
scrollInner:SetAttribute("DontMoveThisFrameLmao", true)
AddInputEvents(scroll, {
PropChange_CanvasPosition = function(_, Position)
scrollInner.Position = UDim2.fromOffset(0, -Position.Y)
end,
})
end
local CacheIndex, UserDataIndex = "_Cache0", "UserData1"
local DataStore = DSS:GetDataStore("__InfiniteCraft")
local GotCache, Cache = pcall(function()
return DataStore:GetAsync(CacheIndex)
end)
local ElementRecipeCache = GotCache and Cache or {}
do
local Count = 0
local NewCount = 0
for _, Element in ElementRecipeCache do
Count += 1
if Element.isNew then
NewCount += 1
end
end
print(`There are: {Count} cached combinations.`)
end
local Elements = {
["Water"] = {
icon = "💧",
creation = 100,
},
["Fire"] = {
icon = "🔥",
creation = 200,
},
["Wind"] = {
icon = "🌬️",
creation = 300,
},
["Earth"] = {
icon = "🌍",
creation = 400,
}
}
local GotSave, Save = pcall(function()
return DataStore:GetAsync(UserDataIndex..Player.UserId)
end)
if GotSave and Save then
local Discovered = 0
for Element, Data in Save do
if Element:sub(1,1) == "_" then continue end
if Element == "Nothing" then continue end
if not Elements[Element] then
Elements[Element] = Data
if Data.madeBy == Player.UserId and Data.isNew then
Discovered += 1
end
end
end
print(`You have discovered {Discovered} element(s).`)
end
function CountDict(t)
local n = 0
for _ in t do
n += 1
end
return n
end
local ElementCount = CountDict(Elements)
elementCount.Text = `Elements: {ElementCount}`
function FadeFrame(Frame, TweenInf, Transparency)
local AllObjects = Frame:GetDescendants()
table.insert(AllObjects, Frame)
for _, Object in AllObjects do
if Object:IsA("Frame") then
TWS:Create(Object, TweenInf, {BackgroundTransparency = Transparency}):Play()
end
if Object:IsA("TextLabel") then
TWS:Create(Object, TweenInf, {TextTransparency = Transparency}):Play()
end
if Object:IsA("ImageLabel") then
TWS:Create(Object, TweenInf, {ImageTransparency = Transparency}):Play()
end
end
end
local PlacedItems = {}
local DragOffset = UDim2.new()
local ItemTweenInfo = TweenInfo.new(0.15, Enum.EasingStyle.Linear)
local ActiveSelection
do
local HoverColor = Color3.fromRGB(120, 170, 170)
local DefaultColor = Color3.fromRGB(203, 203, 203)
function SetSelectionEffects(Object, Bool)
local Grad, Stroke = Object:FindFirstChild("UIGradient"), Object:FindFirstChild("UIStroke")
if Grad then
Grad.Enabled = Bool
end
if Stroke then
Stroke.Color = Bool and HoverColor or DefaultColor
end
end
end
local DragItem
local DoubleClickCounter = {}
local ItemEvents
ItemEvents = {
MouseEnter = function(Object)
if IsDragging and IsDragging ~= Object then return end
if ActiveSelection and ActiveSelection ~= Object then
SetSelectionEffects(ActiveSelection, false)
end
ActiveSelection = Object
SetSelectionEffects(Object, true)
end,
MouseLeave = function(Object)
if IsDragging == Object then return end
SetSelectionEffects(Object, false)
end,
InputBegan = function(Object, Input)
if ActiveSelection == Object and Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
if Object.Parent ~= nil then
local Clicks = DoubleClickCounter[Object]
if not Clicks then
Clicks = 1
DoubleClickCounter[Object] = Clicks
else
Clicks += 1
DoubleClickCounter[Object] = Clicks
end
task.delay(0.14, function()
DoubleClickCounter[Object] -= 1
end)
if Clicks > 1 then
local NewItem = Object:Clone()
NewItem.Position = UDim2.fromOffset(Object.AbsolutePosition.X + Object.AbsoluteSize.X / 2, Object.AbsolutePosition.Y + (Object.AbsoluteSize.Y * ItemTabScale) + 10)
NewItem.Parent = Object.Parent
local AllObjects = NewItem:GetDescendants()
table.insert(AllObjects, NewItem)
for _, Object in AllObjects do
if Object:IsA("Frame") then
Object.BackgroundTransparency = 1
end
if Object:IsA("TextLabel") then
Object.TextTransparency = 1
end
if Object:IsA("ImageLabel") then
Object.ImageTransparency = 1
end
end
NewItem.UIScale.Scale = 0.6
NewItem.ZIndex = 3
FadeFrame(NewItem, ItemTweenInfo, 0)
TWS:Create(NewItem.UIScale, ItemTweenInfo, {Scale = ItemTabScale + 0.3}):Play()
AddInputEvents(NewItem, table.clone(ItemEvents))
local Index = #PlacedItems + 1
PlacedItems[Index] = NewItem
NewItem:SetAttribute("Index", Index)
return
end
DragOffset = UDim2.fromOffset(Object.AbsolutePosition.X - MouseX, Object.AbsolutePosition.Y - MouseY) + UDim2.fromOffset(Object.AbsoluteSize.X / 2, Object.AbsoluteSize.Y / 2)
DragItem(Object)
end
end
end
}
function IsColliding(P1, P2)
return (P1.AbsolutePosition.X < P2.AbsolutePosition.X + P2.AbsoluteSize.X and P1.AbsolutePosition.X > P2.AbsolutePosition.X - P2.AbsoluteSize.X) and (P1.AbsolutePosition.Y < P2.AbsolutePosition.Y + P2.AbsoluteSize.Y and P1.AbsolutePosition.Y > P2.AbsolutePosition.Y - P1.AbsoluteSize.Y )
end
function SoundEffect(ID, Props)
local New = Instance.new("Sound")
New.PlayOnRemove = true
New.SoundId = "rbxassetid://"..ID
for i, v in Props do
New[i] = v
end
New.Parent = Part
New:Destroy()
return New
end
local LastItemDragged
function DragItem(NewItem)
if LastItemDragged ~= NewItem then
NewItem.ZIndex += 1
end
LastItemDragged = NewItem
NewItem.AnchorPoint = Vector2.one / 2
NewItem.Position = UDim2.fromOffset(MouseX, MouseY) + DragOffset
NewItem.Parent = SurfaceUI
IsDragging = NewItem
local OriginalScale = ItemTabScale + 0.3
local Scale = OriginalScale
local Index = NewItem:GetAttribute("Index")
local Active
SetSelectionEffects(NewItem, true)
SoundEffect(Sounds.instance, {PlaybackSpeed = 1 + (math.random() / 7)})
while IsDragging do
local DT = task.wait()
local Alpha = 1 - (1e-16 ^ DT)
NewItem.Position = NewItem.Position:Lerp(UDim2.fromOffset(MouseX, MouseY) + DragOffset, Alpha)
Alpha = 1 - (1e-5 ^ DT)
local Colliding = false
for OtherIndex, OtherItem in PlacedItems do
if OtherItem ~= NewItem and IsColliding(NewItem, OtherItem) then
Scale += ((OriginalScale + 0.1) - Scale) * Alpha
Colliding = true
Active = OtherItem
break
end
end
if not Colliding then
Scale += (OriginalScale - Scale) * Alpha
end
if Active and Active.Parent then
Active.UIScale.Scale = Scale
end
if NewItem.Parent then
NewItem.UIScale.Scale = Scale
end
end
SetSelectionEffects(NewItem, false)
task.spawn(function()
while Scale ~= OriginalScale do
local DT = task.wait()
local Alpha = 1 - (1e-5 ^ DT)
Scale += (OriginalScale - Scale) * Alpha
if Active and Active.Parent then
Active.UIScale.Scale = Scale
end
if NewItem.Parent then
NewItem.UIScale.Scale = Scale
end
end
end)
if NewItem.AbsolutePosition.X + NewItem.AbsoluteSize.X >= side.AbsolutePosition.X then
SoundEffect(Sounds.delete, {PlaybackSpeed = 1 + (math.random() / 7)})
FadeFrame(NewItem, ItemTweenInfo, 1)
TWS:Create(NewItem.UIScale, ItemTweenInfo, {Scale = 0.6}):Play()
if Index then
PlacedItems[Index] = nil
end
task.wait(ItemTweenInfo.Time)
NewItem:Destroy()
return
end
for OtherIndex, OtherItem in PlacedItems do
if OtherItem ~= NewItem and IsColliding(NewItem, OtherItem) then
local RecipeIndex = `{NewItem.Name} + {OtherItem.Name}`
local Success, Data = true, ElementRecipeCache[RecipeIndex]
if not Data then
Success, Data = pcall(function()
return HttpGet(`https://dark.scriptlang.com/api/icrafter/{HTTPS:UrlEncode(NewItem.Name)}/{HTTPS:UrlEncode(OtherItem.Name)}`, true)
end)
if Success then
Data.madeBy = Player.UserId
ElementRecipeCache[RecipeIndex] = Data
pcall(DataStore.SetAsync, DataStore, CacheIndex, ElementRecipeCache)
else
print("Failed to get uncached element.")
warn(Data)
end
end
if Success and Data ~= "Not allowed" then
if Data.result == "Nothing" then
SoundEffect(Sounds.error, {PlaybackSpeed = 1 + (math.random() / 7)})
return
end
if Index then
PlacedItems[Index] = nil
end
PlacedItems[OtherIndex] = nil
if Data.isNew then
-- HOLY CRAP NEW ELEMENT DISCOVERED IN ROBLOX1!!!!!!
local Fade = Instance.new("Frame")
Fade.ZIndex = 10000000
Fade.BackgroundColor3 = Color3.new()
Fade.Size = UDim2.fromScale(1, 1)
Fade.Active = false
Fade.BackgroundTransparency = 1
Fade.Parent = SurfaceUI
TWS:Create(Fade, TweenInfo.new(1), {BackgroundTransparency = 0}):Play()
SoundEffect(1336756135, {})
task.wait(1.6)
game:GetService("TweenService"):Create(Fade, TweenInfo.new(0.8), {BackgroundColor3 = Color3.new(1, 1, 1)}):Play()
SoundEffect(1843115950, {Volume = 1})
SoundEffect(201858045, {})
task.wait(0.45)
game:GetService("TweenService"):Create(Fade, TweenInfo.new(1), {BackgroundColor3 = Color3.new()}):Play()
local Text = Instance.new("TextLabel")
Text.TextScaled = true
Text.Size = UDim2.fromOffset(SurfaceUI.AbsoluteSize.X * 0.45, SurfaceUI.AbsoluteSize.Y * 0.45)
Text.Text = `{Data.emoji} {Data.result}`
Text.AnchorPoint = Vector2.one / 2
Text.Position = UDim2.fromScale(0.5, 0.5)
Text.TextColor3 = Color3.new(1, 1, 1)
Text.BackgroundTransparency = 1
Text.Parent = Fade
task.spawn(function()
local Alpha = 0
while true do
Alpha += task.wait()
if Alpha >= 1 then break end
Text.Rotation = math.random(-22, 22) * (1 - Alpha)
Text.Position = UDim2.new(0.5, math.random(-28, 28) * (1 - Alpha), 0.5, math.random(-28, 28) * (1 - Alpha))
end
Text.Rotation = 0
Text.Position = UDim2.fromScale(0.5, 0.5)
end)
task.wait(1)
local Text = Instance.new("TextLabel")
Text.TextScaled = true
Text.Size = UDim2.fromOffset(SurfaceUI.AbsoluteSize.X * 0.5, SurfaceUI.AbsoluteSize.Y * 0.08)
Text.Text = "Undiscovered element"
Text.AnchorPoint = Vector2.new(0.5, 1)
Text.Position = UDim2.fromScale(0.5, 0)
Text.TextColor3 = Color3.new(1, 1, 1)
Text.BackgroundTransparency = 1
Text.Parent = Fade
TWS:Create(Text, TweenInfo.new(1.5), {Position = UDim2.fromScale(0.5, 0.05) + UDim2.fromOffset(0, Text.Size.Y.Offset)}):Play()
task.wait(4)
FadeFrame(Fade, TweenInfo.new(3), 1)
task.delay(3, game.Destroy, Fade)
SoundEffect(Sounds.discovery, {PlaybackSpeed = 1 + (math.random() / 7)})
else
SoundEffect(Sounds.instance, {PlaybackSpeed = 1 + (math.random() / 7)})
end
local MergedItem = item:Clone()
local Text, Scale = MergedItem:WaitForChild("Text"), MergedItem:WaitForChild("UIScale")
local Size = game:GetService("TextService"):GetTextSize(Data.emoji .. " " .. Data.result, ItemFontSize, Enum.Font.SourceSans, Vector2.new(9e9, 0))
local SizeX = Size.X + 10
Scale.Scale = 0.6
TWS:Create(Scale, ItemTweenInfo, {Scale = ItemTabScale + 0.3}):Play()
Text.Text = Data.emoji .. " " .. Data.result
Text.Position = UDim2.fromOffset(5, 0)
Text.Size = UDim2.new(1, 0, 0, 30)
MergedItem.Name = Data.result
MergedItem.AnchorPoint = Vector2.one / 2
MergedItem.Position = OtherItem.Position:Lerp(NewItem.Position, 0.5)
MergedItem.Size = UDim2.fromOffset(SizeX, 30)
MergedItem.ZIndex = 3
MergedItem.Parent = SurfaceUI
local NewIndex = #PlacedItems + 1
PlacedItems[NewIndex] = MergedItem
MergedItem:SetAttribute("Index", NewIndex)
AddInputEvents(MergedItem, table.clone(ItemEvents))
for _, Object in NewItem:GetChildren() do
if Object:IsA("UIGradient") or Object:IsA("UIStroke") then
Object:Destroy()
end
end
for _, Object in OtherItem:GetChildren() do
if Object:IsA("UIGradient") or Object:IsA("UIStroke") then
Object:Destroy()
end
end
local ThisScale, OtherScale = NewItem:FindFirstChild("UIScale"), OtherItem:FindFirstChild("UIScale")
if ThisScale then
TWS:Create(ThisScale, ItemTweenInfo, {Scale = 0.6}):Play()
end
if OtherScale then
TWS:Create(OtherScale, ItemTweenInfo, {Scale = 0.6}):Play()
end
FadeFrame(NewItem, ItemTweenInfo, 1)
FadeFrame(OtherItem, ItemTweenInfo, 1)
task.delay(ItemTweenInfo.Time, function()
if not Elements[Data.result] then
Elements[Data.result] = {
icon = Data.emoji,
creation = os.clock(),
isNew = Data.isNew,
madeBy = Player.UserId,
}
NewItemTab(Data.result, Data.emoji)
SoundEffect(Sounds.reward, {PlaybackSpeed = 1 + (math.random() / 7)})
pcall(DataStore.SetAsync, DataStore, UserDataIndex..Player.UserId, Elements)
ElementCount += 1
elementCount.Text = `Elements: {ElementCount}`
end
NewItem:Destroy()
OtherItem:Destroy()
end)
end
break
end
end
end
function NewItemTab(ElementName, ElementIcon, Order)
local Item = item:Clone()
Item.LayoutOrder = math.round((Order or os.clock()))
Item.Name = ElementName
local Text, IconImage = Item:WaitForChild("Text"), Item:WaitForChild("ImageIcon")
local SizeX = 0
if not ElementIcon:find(":") then
local Size = game:GetService("TextService"):GetTextSize(ElementIcon .. " " .. ElementName, ItemFontSize, Enum.Font.SourceSans, Vector2.new(9e9, 0))
SizeX = Size.X + 10
Text.Position = UDim2.fromOffset(5, 0)
Text.Size = UDim2.new(1, 0, 0, 30)
Text.Text = ElementIcon .. " " .. ElementName
else
local Size = game:GetService("TextService"):GetTextSize(ElementName, ItemFontSize, Enum.Font.SourceSans, Vector2.new(9e9, 0))
SizeX = Size.X + 30 + 10
IconImage.Image = ElementIcon
end
local PositionX = (LastItemTab and LastItemTab.Position.X.Offset + LastItemTab.Size.X.Offset + scrollList.Padding.Offset or 0)
Item.Size = UDim2.fromOffset(SizeX, 30)
CurrentItemTabSegmentItems += 1
CurrentItemTabSegment.Name = (tonumber(CurrentItemTabSegment.Name) or 0) + Item.LayoutOrder
if PositionX + SizeX >= scrollInner.AbsoluteSize.X / ItemTabScale then
PositionX = 0
CurrentItemTabSegment = CurrentItemTabSegment:Clone()
for i,v in CurrentItemTabSegment:GetChildren() do
if v:IsA("Frame") then
v:Destroy()
end
end
CurrentItemTabSegment.LayoutOrder = tonumber(CurrentItemTabSegment.Name)
CurrentItemTabSegment.Name = "0"
CurrentItemTabSegment.Parent = scrollInner
CurrentItemTabSegmentItems = 0
end
Item.Position = UDim2.fromOffset(PositionX, 0)
Item.Parent = CurrentItemTabSegment
LastItemTab = Item
local Events = table.clone(ItemEvents)
Events.InputBegan = function(_, Input)
if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
DragOffset = UDim2.fromOffset(Item.AbsolutePosition.X - MouseX, Item.AbsolutePosition.Y - MouseY) + UDim2.fromOffset(Item.AbsoluteSize.X / 2, Item.AbsoluteSize.Y / 2)
local NewItem = Item:Clone()
local AllObjects = NewItem:GetDescendants()
table.insert(AllObjects, NewItem)
for _, Object in AllObjects do
if Object:IsA("Frame") then
Object.BackgroundTransparency = 1
end
if Object:IsA("TextLabel") then
Object.TextTransparency = 1
end
if Object:IsA("ImageLabel") then
Object.ImageTransparency = 1
end
end
NewItem.UIScale.Scale = 0.6
NewItem.ZIndex = 3
FadeFrame(NewItem, ItemTweenInfo, 0)
TWS:Create(NewItem.UIScale, ItemTweenInfo, {Scale = ItemTabScale + 0.3}):Play()
local Index = #PlacedItems + 1
PlacedItems[Index] = NewItem
NewItem:SetAttribute("Index", Index)
DragItem(NewItem)
AddInputEvents(NewItem, table.clone(ItemEvents))
end
end
AddInputEvents(Item, Events)
end
function ClearItemList()
LastItemTab = nil
CurrentItemTabSegment = CurrentItemTabSegment:Clone()
for i,v in CurrentItemTabSegment:GetChildren() do
if v:IsA("Frame") then
v:Destroy()
end
end
CurrentItemTabSegment.Name = "0"
for _, Object in scrollInner:GetChildren() do
if Object:IsA("Frame") then
Object:Destroy()
end
end
CurrentItemTabSegment.Parent = scrollInner
end
do
local Debounce = false
local SortID = 0
function SortByTime(Elements)
ClearItemList()
SortID += 1
local ID = SortID
local SortedElements = {}
for Name, Data in Elements do
if Name:sub(1,1) == "_" then continue end
Data.name = Name
table.insert(SortedElements, Data)
end
table.sort(SortedElements, function(A, B)
return A.creation < B.creation
end)
for Index, Data in ipairs(SortedElements) do
if SortID ~= ID then
print("Cancel load")
break
end
NewItemTab(Data.name, Data.icon, Data.creation)
if Index % 100 == 0 then
task.wait()
end
end
end
local SortTypes = {
{"⌛ Sort by time", function()
SortByTime(Elements)
end},
}
local Sort = 1
AddInputEvents(sortByButton, {
InputBegan = function(_, Input)
if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
if Debounce then return end
Debounce = true
Sort += 1
if Sort > #SortTypes then
Sort = 1
end
sortByButtonText.Text = SortTypes[Sort][1]
SortTypes[Sort][2]()
task.wait(0.5)
Debounce = false
end
end,
})
end
do
local Debounce = false
local Selected = false
AddInputEvents(discoveriesButton, {
InputBegan = function(_, Input)
if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
if Debounce then return end
Debounce = true
Selected = not Selected
discoveriesButton.BackgroundColor3 = Color3.new(1, 1, 1):Lerp(Color3.new(1, 1, 0), Selected and 0.08 or 0)
ClearItemList()
if Selected then
task.spawn(function()
for Name, Data in Elements do
if Name:sub(1,1) == "_" then continue end
if Data.isNew and Data.madeBy == Player.UserId then
NewItemTab(Data.name, Data.icon, Data.creation)
end
end
end)
else
SortByTime(Elements)
end
task.wait(0.5)
Debounce = false
end
end,
})
end
do
local FakeSearchBox = searchBox:Clone()
FakeSearchBox.Active = false
FakeSearchBox:SetAttribute("HideOnClient", true)
FakeSearchBox.Parent = searchBox.Parent
searchBox.Visible = false
AddInputEvents(searchBox, {
PropChange_Text = function(_, Text)
FakeSearchBox.Text = Text
if Text == "" then
for _, Object in scrollInner:GetChildren() do
if Object:IsA("Frame") then
for _, Item in Object:GetChildren() do
if Item:IsA("Frame") then
Item.Visible = false
end
end
Object.Visible = false
end
end
end
Text = Text:lower()
for _, Object in scrollInner:GetChildren() do
if Object:IsA("Frame") then
local AtleastOne = false
for _, Item in Object:GetChildren() do
if Item:IsA("Frame") then
local Valid = Item.Name:lower():sub(1, #Text) == Text
if Valid then
AtleastOne = true
end
Item.Visible = Valid
end
end
Object.Visible = AtleastOne
end
end
end,
})
end
do
local function FormatTime(seconds)
if seconds < 60 then
return string.format("%d seconds", seconds)
elseif seconds < 3600 then
local minutes = math.floor(seconds / 60)
return string.format("%d minutes", minutes)
else
local hours = math.floor(seconds / 3600)
return string.format("%d hours", hours)
end
end
local Playtime = Save and Save._Playtime or 0
elementCount.TextYAlignment = Enum.TextYAlignment.Top
elementCount.Size += UDim2.fromScale(0.08, 0.04)
task.spawn(function()
while true do
Playtime += task.wait(0.1)
elementCount.Text = `Elements: {ElementCount}\nPlay time: {FormatTime(math.round(Playtime))}\n\nMade by: synarxx`
Elements._Playtime = Playtime
end
end)
task.spawn(function()
while true do
task.wait(30)
DataStore:SetAsync(UserDataIndex..Player.UserId, Elements)
end
end)
end
SortByTime(Elements)