Sign up
Login
New
Trending
Archive
English
English
Sign up
Login
New Paste
Add Image
local BaseHandler = { } --Services local RepStorage = game.ReplicatedStorage local SS = game.ServerStorage --Folders local Remotes = RepStorage.Remotes local Modules = SS.Modules --Remotes local ClientRep = Remotes.ClientRep local ObjectRemote = Remotes.Object --Modules local SetProperties = require(Modules.SetProperties) local Format = require(Modules.FormatNumbers) local ConveyorInfo = require(Modules.ConveyorInfo) local StealingModule = require(Modules.StealingModule) local InsertModule = require(Modules:WaitForChild("Insert")) --Tables local PlrThings = {} local RarityMultipliers = { Common = 1, Rare = 3, Legendary = 5, Mythical = 20 } function BaseHandler.new(MyData) local NewBaseHandler = {} local self = NewBaseHandler local MyPlr:Player = MyData.Plr self.MySlots = MyData.Data.Slots self.SlotMoney = {} BaseHandler[MyPlr.Name] = self -- For Other script reference self.MyData = MyData --Threads local SlotConnections = {} --table.clear(self.MySlots) -- function self:Initialize() --Find Base local Found = false repeat task.wait() until MyPlr.Character for i,v in pairs(workspace:GetChildren()) do if string.find(v.Name,"Base") and v:IsA('Model') and not v:HasTag("Occupied") then print('Base Found') Found = true self.Base = v v:AddTag("Occupied") print(self.MySlots) for i,v in pairs(self.MySlots) do local Slot = self.Base.Slots:FindFirstChild(i) if Slot then v.Offline = true NewBaseHandler:AddNewThing(Slot,v) end end break end end if not Found then MyPlr:Kick() end local MultiClone = RepStorage.Stuff.Multiplier:Clone() MultiClone.Parent = self.Base.Spawn self.Configuration = self.Base.Configuration --print(self.Configuration) self.Configuration.Multiplier.Changed:Connect(function() MultiClone.BillboardGui.MultiAmount.Text = "x"..self.Configuration.Multiplier.Value end) -- Check If Plr Was Stealing self.Base.CollectZone.Touched:Connect(function(hit:BasePart) if hit then local IsPlr = hit:IsDescendantOf(MyPlr.Character) local IsStealing = StealingModule.CurrentlyStolen[MyPlr.Name] if IsStealing and IsPlr then local Info = IsStealing.Info local VacantSlot = NewBaseHandler:FindVacantSlot() if VacantSlot and Info then print('Stolen') StealingModule.SuccsessfulSteal(MyPlr) Info.Offline = false NewBaseHandler:AddNewThing(VacantSlot,Info) end end end end) -- --When Player Dies, cancel all steals MyPlr.CharacterAdded:Connect(function(Char) local RootPart:Part = Char:WaitForChild("HumanoidRootPart") local Hum:Humanoid = Char:WaitForChild("Humaoid") Hum.Died:Connect(function() StealingModule.Stop(MyPlr) end) RootPart.CFrame = self.Base.Spawn.CFrame end) local RootPart = MyPlr.Character:WaitForChild("HumanoidRootPart") RootPart.CFrame = self.Base.Spawn.CFrame --Set Up Collecting local SlotFolder:Folder = self.Base:WaitForChild('Slots') -- Set Door Status task.wait(1) NewBaseHandler:SetDoorStatus(false) for i,v in pairs(BaseHandler) do if typeof(v) == "table" then v:SetDoorStatus(false) end end end function self:CreateRoot() local NewPart = Instance.new('Part',workspace) NewPart.Size = Vector3.one * 4 NewPart.BrickColor = BrickColor.Red() NewPart.CanCollide = false NewPart.Anchored = true NewPart.Transparency = .5 NewPart.Massless = true return NewPart end --Door Mechanics function self:SetDoorStatus(bool) local Transparency = (not bool and 1) or 0 for i,v in pairs(self.Base:GetDescendants()) do if v.Name == "Doors" then for i,doorstuff in pairs(v:GetDescendants()) do if doorstuff:IsA("BasePart") then local Properties = {CanCollide = bool} Properties.Transparency = (doorstuff.Name == "Hitbox" and 1) or Transparency SetProperties.AllBut(MyPlr,doorstuff,Properties) SetProperties.Client(MyPlr,doorstuff,Properties) end end end end end --Remove Item function self:RemoveItem(SlotName) local ItemInfo = self.MySlots[SlotName] local MainPart:BasePart = ItemInfo.MainPart or workspace:FindFirstChild(ItemInfo.PartName) local ThingPrice = ConveyorInfo[ItemInfo.Name].Price local SlotModel = self.Base.Slots:FindFirstChild(SlotName) MyData:AwardCash(ThingPrice/2) MainPart:Destroy() ObjectRemote:FireClient(MyPlr,"PlaySFX",{Parent = SlotModel,SFXName = "Sold"}) local CollectConnection = SlotConnections[SlotName] self.MySlots[SlotName] = nil if CollectConnection then task.cancel(CollectConnection) end end --Add New Item to base function self:AddNewThing(Slot,contents) if typeof(contents) == "boolean" then contents = {} end local ItemName = contents.Name or "Sparkles" local Rarity = contents.Rarity or "Common" local Mutations = contents.Mutations or {} --print(contents) --Create a Part to hold the model, that will be handle from client side local HolderPart = Slot.Spawn local NewPart = self:CreateRoot() NewPart.Transparency = 1 local NewPrompt = Instance.new('ProximityPrompt',NewPart) NewPart.Name = "Part"..math.random(-1000000000,1000000000) local PartSize = NewPart.Size NewPart.CFrame = HolderPart.CFrame NewPart.Position += Vector3.new(0,(PartSize.Y/2),0) --Handle Item Info local ItemInfo = ConveyorInfo[ItemName] or {} local Price = ItemInfo.Price or 0 local MoneyPerSec = ItemInfo.MoneyPerSec or 0 --HandlePrompts local PromptName = "CurrentPrompt"..math.random(-1000000000,1000000000) NewPrompt.Name = PromptName NewPrompt.Parent = NewPart local TotalPrice = BaseHandler.CalulatePrice(ItemInfo,Rarity,Mutations) NewPrompt.ActionText = "Sell For "..Format.Format(TotalPrice/2) SetProperties.AllBut(MyPlr,NewPrompt,{ActionText = "Steal",PromptName = PromptName}) contents.PartName = NewPart.Name table.insert(PlrThings,{NewPart,contents}) --Load Main Model On Client for optimisation Price = Format.Format(TotalPrice) MoneyPerSec = Format.Format(MoneyPerSec).."/s" contents.Price = Price contents.MoneyPerSec = MoneyPerSec contents.MainPart = NewPart ObjectRemote:FireAllClients("NewModel",contents) --Get Inital CFrame for new things, incase we need to returns steals without, reloading local OgCF = NewPart.CFrame --Store self.MySlots[Slot.Name] = contents --Decide between BaseOwner and Other Players NewPrompt.Triggered:Connect(function(Plr) local IsStealing = Plr ~= MyPlr local CurrentChar = Plr.Character if not IsStealing then --Handle Selling print('gon sell') -- Remove Item From Data self:RemoveItem(Slot.Name) else --Verify Player Has A vacant slot --if not NewBaseHandler:FindVacantSlot() then return end --Stealing local IsStealing = StealingModule.CurrentlyStolen[Plr.Name] if IsStealing then return end --Start up stealing SetProperties.AllClients(NewPrompt,{Enabled = false}) ObjectRemote:FireClient(Plr,"Anim",{Prog = true,Name = "Hold"}) StealingModule.Steal(Plr,NewPart,self.MySlots[Slot.Name],OgCF,Slot.Name,NewBaseHandler) end end) --Collect Money local CollectPart:BasePart = Slot.Collect local CollectUI = CollectPart:FindFirstChild("CollectUI") local CollectAmount = (CollectUI and CollectUI.BillboardGui.CollectAmount) or nil local CollectTitle = (CollectUI and CollectUI.BillboardGui.Collect) or nil if not CollectUI then local UI = RepStorage.Stuff.CollectUI:Clone() UI.Parent = CollectPart CollectAmount = UI.BillboardGui.CollectAmount CollectTitle = UI.BillboardGui.Collect end --Offline Money local TimeDiffrence = (tick() - self.MyData.Data.LastLeft) print(self:CalulateMultipliers(Mutations)) print(contents.Offline) local OfflineMoney = (ItemInfo.MoneyPerSec * self:CalulateMultipliers(Mutations) ) * ((contents.Offline and TimeDiffrence) or 0) self.SlotMoney[Slot.Name] = OfflineMoney local OfflineCollected = false CollectTitle.Text = "Collect ".. (contents.Offline == true and (" (Offline Money)") or "") --Collect Money CollectPart.Touched:Connect(function(hit) local IsChar = hit:IsDescendantOf(MyPlr.Character) --print(IsChar) if IsChar then local Money = self.SlotMoney[Slot.Name] MyData:AwardCash(self.SlotMoney[Slot.Name] or 0) self.SlotMoney[Slot.Name] = 0 CollectAmount.Text = "$".."0" if not OfflineCollected then OfflineCollected = true CollectTitle.Text = "Collect" end end end) --Set Up Inindividual Collect Connections local CollectConnection = task.spawn(function() while task.wait(1) do self:AddMoney(Slot) end end) SlotConnections[Slot.Name] = CollectConnection end --Money function self:CalulateMultipliers(Mutations) Mutations = Mutations or {} local GamePassMulti = MyData.Data.OwnedPasses['2xMoney'] and 2 or 1 local RebirthMulti = math.max(MyData.Data.MyStats.Rebirths,1) local MutationMulti = (#Mutations == 0 and 1) or (Mutations == 1 and 2) or Mutations local TotalMulti = (GamePassMulti * RebirthMulti * MutationMulti) return TotalMulti end function self:AddMoney(SlotModel) if not SlotModel then return end local Slot = SlotModel.Name local Collect = SlotModel.Collect local CollectUI = Collect:FindFirstChild("CollectUI") if not CollectUI then return end local BillBoard = CollectUI:FindFirstChild("BillboardGui") local CollectLabel:TextLabel = BillBoard:FindFirstChild("CollectAmount") if not self.SlotMoney[Slot] then self.SlotMoney[Slot] = 0 end local Thing = self.MySlots[Slot] if not Thing then return end --print(Slot) local Info = ConveyorInfo[Thing.Name] or {} local MoneyPerSec = Info.MoneyPerSec or 1 local MutationMulti = Thing.Mutations or {} local GamepassMulti = MyData.Data.OwnedPasses["2xMoney"] and 2 or 1 --Stats local Rebirths = MyData.Data.MyStats.Rebirths or 0 local RebirthMulti = (Rebirths > 0) and Rebirths or 1 MutationMulti = (#MutationMulti > 0 and #MutationMulti) or 1 -- local TotalMultiplier = self:CalulateMultipliers(Thing.Mutations) local AddedMoney = MoneyPerSec * TotalMultiplier self.Configuration.Multiplier.Value = TotalMultiplier self.SlotMoney[Slot] += AddedMoney local CurrentMoney = self.SlotMoney[Slot] local CashTotal,NewTotal = Format.Format(CurrentMoney) CollectLabel.Text = CashTotal -- end -- function self:FindVacantSlot() for i,v in pairs(self.Base.Slots:GetChildren()) do if not self.MySlots[v.Name] then return v end end return false end return self end -- For once players leave function BaseHandler.ClearBase(BaseHandler) BaseHandler = BaseHandler or {} local Base:Model = BaseHandler.Base if not Base then return end for i,v in pairs(Base:GetDescendants()) do if v:IsA('ProximityPrompt') or v:IsA('BillboardGui') then v.Parent:Destroy() end end for i,v in pairs(BaseHandler.MySlots) do if v.MainPart then v.MainPart:Destroy() end end end --Put here for flexibility between, ConveyorBeltModule and BaseHandlerModule function BaseHandler.CalulatePrice(Info,Rarity,Mutations) Info = Info or {} Rarity = Rarity or "Common" Mutations = Mutations or {} local InitalPrice = Info.Price or 0 local MutationMulti = math.max(#Mutations,1) local RarityMulti = RarityMultipliers[Rarity] local TotalPrice = InitalPrice * RarityMulti * MutationMulti return TotalPrice end -- return BaseHandler --ConveyerBelt Module local ConveyorBelt = {Objects = {}} --Services local SS = game.ServerStorage local RepStorage = game.ReplicatedStorage local RunService = game["Run Service"] --Stuff local Origin = workspace.Origin local End = workspace.End --Folders local Modules = SS.Modules local Stuff = SS.Stuff local Remotes = RepStorage.Remotes --Modules local BaseHandler = require(Modules:WaitForChild("BaseHandler")) local SetProperties = require(Modules:WaitForChild("SetProperties")) local ConveyorInfo = require(Modules:WaitForChild("ConveyorInfo")) local NumberFormat = require(Modules:WaitForChild('FormatNumbers')) --Remotes local ClientRep = Remotes.ClientRep local Object = Remotes.Object --Values local Speed = 35 --Add something new to the conveyor function ConveyorBelt.CreateNew(Name,Rarity,Mutations) --Verify parameters aren't nil Rarity = Rarity or "Common" Name = Name or "Sparkles" Mutations = Mutations or {} -- local TablePos = #ConveyorBelt.Objects + 1 local Target local NewThing = Instance.new("Part",workspace) NewThing.CanCollide = false NewThing.Size = Vector3.one * 4 NewThing.BrickColor = BrickColor.Red() NewThing.Transparency = 1 NewThing.CFrame = workspace.Origin.CFrame NewThing.Position = NewThing.Position + Vector3.new(0,-NewThing.Position.Y + workspace.Road.Position.Y + (workspace.Road.Size.Y/2 + NewThing.Size.Y/2),0) NewThing.Massless = false local NewStats = Stuff.Attachment:Clone() NewStats.WorldPosition = NewThing.Position + Vector3.new(0,NewThing.Size.Y + 1,0) --Forces, custom movement system since, using humanoids can create lag local Attachment = Instance.new('Attachment',NewThing) local AlignOrientation = Instance.new('AlignOrientation',NewThing) local LinearVel = Instance.new('LinearVelocity',NewThing) LinearVel.Attachment0 = Attachment AlignOrientation.Attachment0 = Attachment LinearVel.VectorVelocity = NewThing.CFrame.LookVector * Speed LinearVel.MaxForce = 111111 AlignOrientation.RigidityEnabled = true AlignOrientation.Mode = Enum.OrientationAlignmentMode.OneAttachment -- local RandomName = "Part"..math.random(-1000000000,1000000000) NewThing.Name = RandomName local ItemInfo = ConveyorInfo[Name] or {} local ItemPrice = ItemInfo.Price or 0 local MoneyPerSec = ItemInfo.MoneyPerSec or 0 local TotalPrice = BaseHandler.CalulatePrice(ItemInfo,Rarity,Mutations) MoneyPerSec = NumberFormat.Format(MoneyPerSec).."/s" ItemPrice = NumberFormat.Format(TotalPrice) local contents = {Name = Name,PartName = RandomName,Rarity = Rarity,Price = ItemPrice,MoneyPerSec = MoneyPerSec} Object:FireAllClients("NewModel",contents) local Mag = (Origin.Position - End.Position).Magnitude local conn = task.delay(Mag/Speed,function() NewThing:Destroy() table.remove(ConveyorBelt.Objects,TablePos) task.cancel(contents.LookConnection) end) --Prompt local NewPrompt = Instance.new('ProximityPrompt',NewThing) NewPrompt.RequiresLineOfSight = false local Price = ItemInfo.Price or 1 NewPrompt.ActionText = "Purchase for "..NumberFormat.Format(TotalPrice) NewPrompt.Triggered:Connect(function(Plr) --Get Players Info local PlrBase = BaseHandler[Plr.Name] local PlrData = PlrBase.MyData local PlrCash = PlrData.Data.MyStats.Cash local VacantSlot = PlrBase:FindVacantSlot() if not VacantSlot or not (PlrCash > TotalPrice) then return end PlrData:AwardCash(-TotalPrice) PlrBase.MySlots[VacantSlot.Name] = contents task.cancel(conn) Object:FireClient(Plr,"PlaySFX",{SFXName = "Purchased",Parent = NewThing}) local BaseModel = PlrBase.Base local Dir = (BaseModel.Spawn.Position - NewThing.Position) local Direction = Dir.Unit * Vector3.new(1,0,1) + Vector3.new(0,NewThing.CFrame.LookVector.Y,0) LinearVel.VectorVelocity = Direction * Speed SetProperties.AllClients(NewPrompt,{Enabled = false}) task.delay(Dir.Magnitude/Speed,function() NewThing:Destroy() if VacantSlot then PlrBase:AddNewThing(VacantSlot,contents) table.remove(ConveyorBelt.Objects,TablePos) task.cancel(contents.LookConnection) end end) end) local LookConnection = task.spawn(function() while true do local dt = RunService.Heartbeat:Wait() AlignOrientation.CFrame = CFrame.lookAlong(NewThing.Position,LinearVel.VectorVelocity.Unit) end end) contents.LookConnection = LookConnection table.insert(ConveyorBelt.Objects,{NewThing,contents}) end return ConveyorBelt -- Data Module local DataModule = {} --Services local SS = game.ServerStorage local DataStoreService = game:GetService("DataStoreService") --Folders local Modules = SS.Modules --Modules local NumbersFormat = require(Modules:WaitForChild("FormatNumbers")) --DataStores local MyDataStore = DataStoreService:GetDataStore("MyDataStore") --Tables local InitalizedData = { MyStats = { Cash = 0, Rebirths = 0 }, Slots = {}, OwnedPasses = {} } function DataModule.new(Plr:Player) if not Plr then return end local DataHandler = {} local self = DataHandler self.key = "Plr"..Plr.UserId self.Plr = Plr DataModule[Plr.Name] = DataHandler local leaderstats local Cash:IntValue function self:Initalize() local Data local sucsess,error = pcall(function() Data = MyDataStore:GetAsync(self.key) end) if not sucsess then --Remove the Players DataTable DataModule[Plr.Name] = nil Plr:Kick("Data Failed To Save") end leaderstats = Plr:WaitForChild("leaderstats") local Rebirths = leaderstats:WaitForChild("Rebirths") Cash = leaderstats:WaitForChild("Cash") if Data then self.Data = Data self:Changed() print(self.Data) else self.Data = table.clone(InitalizedData) end local CashTotal,Total = NumbersFormat.Format(self.Data.MyStats.Cash or 0) Cash.Value = CashTotal Rebirths.Value = self.Data.MyStats.Rebirths or 0 -- for i,v in pairs(InitalizedData.MyStats) do if not self.Data.MyStats[i] then self.Data.MyStats[i] = v end end self.Data.OwnedPasses["2xMoney"] = false -- end function self:SaveData() for i,v in pairs(self.Data.Slots) do v.MainPart = nil end MyDataStore:SetAsync(self.key,self.Data) end function self:Award(Name,Amount) local Thing = leaderstats:FindFirstChild(Name) end function self:AwardCash(Amount) Amount = Amount or 0 self.Data.MyStats.Cash += Amount local CashTotal,Total = NumbersFormat.Format(self.Data.MyStats.Cash or 0) Cash.Value = CashTotal end function self:Changed() for i,v in pairs(InitalizedData) do if not self.Data[i] then self.Data[i] = v end end end function self:AutoSave() task.spawn(function() while true do task.wait(30) DataHandler:SaveData() end end) end return self end return DataModule -- Stealing Module local StealingModule = { CurrentlyStolen = {} } --Services local SS = game.ServerStorage local RepStorage = game.ReplicatedStorage --Folders local Modules = SS.Modules local RepModules = RepStorage:WaitForChild("Modules") local Remotes = RepStorage:WaitForChild("Remotes") --Modules --Remotes local ObjectRemote = Remotes.Object --Modules local CurrentStolen = StealingModule.CurrentlyStolen function StealingModule.Steal(Plr:Player,Thing:BasePart,Info,OgCF,Slot,BaseHandler) if not Plr then return end if CurrentStolen[Plr.Name] then return end if not Thing then return end local Char = Plr.Character local Head:BasePart = Char:WaitForChild("Head") Thing.Anchored = false local Weld = Instance.new('Weld',Head) Weld.Part0 = Head Weld.Part1 = Thing Weld.C0 = CFrame.new(0,Head.Size.Y/2 + Thing.Size.Y/2,0) CurrentStolen[Plr.Name] = {Weld = Weld,NewPart = Thing,ogcf = OgCF,Info = Info,Slot = Slot,BaseHandler = BaseHandler} end -- Stealing is Modular, incase a player left while stealing, we can negate it easily function StealingModule.SuccsessfulSteal(Plr:Player) local Info = CurrentStolen[Plr.Name] local BaseHandler = Info.BaseHandler BaseHandler.MySlots[Info.Slot] = nil Info.NewPart:Destroy() Info.Weld:Destroy() CurrentStolen[Plr.Name] = nil ObjectRemote:FireClient(Plr,"Anim",{Name = "Hold",Prog = false}) end function StealingModule.Stop(Plr:Player) if not CurrentStolen[Plr.Name] then return end local Info = CurrentStolen[Plr.Name] local Weld = Info.Weld local NewPart = Info.NewPart local ogcf = Info.ogcf Weld:Destroy() NewPart.Anchored = false NewPart.CFrame = ogcf CurrentStolen[Plr.Name] = nil ObjectRemote:FireClient(Plr,"Anim",{Name = "Hold",Prog = false}) end return StealingModule -- SetProperties Module local SetProperties = {} --Services local RepStorage = game.ReplicatedStorage local Players = game.Players --Folders local Remotes = RepStorage.Remotes --Events local ClientRep = Remotes.ClientRep function SetProperties.AllClients(Object,Properties) ClientRep:FireAllClients(Object,Properties) end function SetProperties.AllBut(Ignore,Object,Properties) for i,v in pairs(Players:GetPlayers()) do if v ~= Ignore then ClientRep:FireClient(v,Object,Properties) end end end function SetProperties.Client(Plr,Object,Properties) ClientRep:FireClient(Plr,Object,Properties) end return SetProperties --- Luck Module local Luck = {} local Chances = { Common = 100, Rare = 19, Legendary = .9, Mythical = .1 } function Luck.Roll() local random = math.random() * 100 for i,v in pairs(Chances) do if random <= v then return i end end end return Luck -- Main Server Handle --Services local Players = game.Players local SS = game.ServerStorage local RepStorage = game.ReplicatedStorage local MarketPlaceService = game.MarketplaceService --Folders local Modules = SS:WaitForChild("Modules") local Remotes = RepStorage.Remotes --Remotes local ObjectRemote = Remotes.Object --Modules local DataModule = require(Modules:WaitForChild("DataModule")) local BaseHandler = require(Modules:WaitForChild("BaseHandler")) local ConveyorBelt = require(Modules:WaitForChild("ConveyorBelt")) local Luck = require(Modules:WaitForChild("Luck")) local ConveyorStuff = require(Modules:WaitForChild("ConveyorStuff")) local FormatNumber = require(Modules:WaitForChild("FormatNumbers")) local StolenModule = require(Modules:WaitForChild('StealingModule')) local DeveloperProducts = require(Modules:WaitForChild('DeveloperProducts')) --Initalize DeveloperProducts.InitalizeGifting() function OnAdded(Plr:Player) --Handle Data local MyData = DataModule.new(Plr) --leaderstats local leaderstats = Instance.new('Folder',Plr) leaderstats.Name = "leaderstats" local Cash = Instance.new("StringValue",leaderstats) Cash.Name = "Cash" local Rebirths = Instance.new("IntValue",leaderstats) Rebirths.Name = "Rebirths" --Initalize Data MyData:Initalize() MyData:AutoSave() --Handle Bases local NewBase = BaseHandler.new(MyData) --Load for i,v in pairs(ConveyorBelt.Objects) do ObjectRemote:FireClient(Plr,"NewModel",v[2]) end local Things = BaseHandler.GetThings() --For prexisting models, load them on the client side for i,v in pairs(Things) do local Part = v[1] local Contents = v[2] if Part and Contents then ObjectRemote:FireClient(Plr,"NewModel",Contents) end end -- NewBase:Initialize() end function OnRemoving(Plr:Player) local MyData = DataModule[Plr.Name] local PlrBase = BaseHandler[Plr.Name] if MyData then MyData.Data.LastLeft = tick() DataModule[Plr.Name] = nil MyData:SaveData() end PlrBase.Base:RemoveTag("Occupied") StolenModule.Stop(Plr) BaseHandler.ClearBase(PlrBase) end Players.PlayerAdded:Connect(OnAdded) Players.PlayerRemoving:Connect(OnRemoving) while task.wait(1) do local Rarity = Luck.Roll() --Rarity = "Legendary" local Possible = ConveyorStuff[Rarity] local RandomObject = Possible[math.random(1,#Possible)] ConveyorBelt.CreateNew(RandomObject,Rarity) local Suffix,Total = FormatNumber.Format(10^6 + 100000) --print(Rarity) end -- Client Module, client replication etc local ClientModule = {} --Plr local Plr = game.Players.LocalPlayer local Mouse = Plr:GetMouse() local Camera = workspace.CurrentCamera local Animator:Animator --Services local RepStorage = game.ReplicatedStorage local UIS = game.UserInputService local RunService = game["Run Service"] --Folders local Models = RepStorage:WaitForChild("Models") local Stuff = RepStorage:WaitForChild("Stuff") local Modules = RepStorage:WaitForChild("Modules") local SFX = RepStorage:WaitForChild("SFX") local Animations = RepStorage:WaitForChild("Animations") --Modules local ColorInfo = require(Modules.Info) --Tables local AnimationTable = {} function ClientModule.NewModel(contents) local Name = contents.Name or "Sparkles" task.spawn(function() local MainPart = workspace:WaitForChild(contents.PartName,100) -- print(MainPart) --Stats local Rarity = contents.Rarity local Price = contents.Price local Mutations = contents.Mutations --GetModel local ReplicaModel:Model = Models:WaitForChild(Name,100) local TotalSize = ReplicaModel:GetExtentsSize() if not ReplicaModel then return end ReplicaModel = ReplicaModel:Clone() ReplicaModel.Parent = MainPart for i,v in pairs(ReplicaModel:GetDescendants()) do if v:IsA("BasePart") then v.CanCollide = false v.Massless = true end end local Core:BasePart = ReplicaModel.Core Core.Transparency = 1 local Weld = Instance.new('Weld',Core) Weld.Part0 = Core Weld.Part1 = MainPart Weld.C0 *= CFrame.new(0,-MainPart.Size.Y/2,0) * CFrame.Angles(0,math.pi,0) --HandleUI local NewAttachment = Stuff:WaitForChild('Attachment'):Clone() NewAttachment.Parent = Core NewAttachment.WorldPosition = Core.Position NewAttachment.Position += Vector3.new(0,TotalSize.Y/2 + 1.5,0) local BillBoardUI = NewAttachment.BillboardGui BillBoardUI.ThingName.Text = Name BillBoardUI.Rarity.Text = Rarity BillBoardUI.Rarity.TextColor3 = ColorInfo[Rarity] or Color3.new(1, 1, 1) BillBoardUI.Price.Text = Price or "" BillBoardUI.MoneyPerSec.Text = contents.MoneyPerSec or "" -- end) end function ClientModule.Insert(contents) local Int = contents.Instance:Clone() Int.Parent = workspace end function ClientModule.PlaySFX(contents) if not contents then return end local SFXName = contents.SFXName local Parent = contents.Parent if Parent then local GetSFX:Sound = SFX:WaitForChild(SFXName,5) if GetSFX then local Clone = GetSFX:Clone() Clone.Parent = Parent Clone:Play() game.Debris:AddItem(Clone,Clone.TimeLength) end end end function ClientModule.Anim(contents) local Name = contents.Name local Progression = contents.Prog local Track = AnimationTable[Name] print('wat') if Progression then Track:Play() else Track:Stop() end end --Animation local function HandleAnimation(Char:Model) local Hum:Humanoid = Char:WaitForChild("Humanoid") Animator = Hum:WaitForChild("Animator") for i,v in pairs(Animations:GetChildren()) do AnimationTable[v.Name] = Animator:LoadAnimation(v) end end Plr.CharacterAdded:Connect(HandleAnimation) repeat task.wait() until Plr.Character HandleAnimation(Plr.Character) return ClientModule -- -- Rest is just game info, like Rarity, Names etc
Settings
Title :
[Optional]
Paste Folder :
[Optional]
Select
Syntax :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Description:
[Optional]
Tags:
[Optional]
Encrypt Paste
(
?
)
Create Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
English