Reversal00

yrea

Feb 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.43 KB | None | 0 0
  1. loc = game.Players.LocalPlayer.PlayerScripts.LocalHandler
  2. Synapse:CopyString(Synapse:Decompile(loc)
  3. -- Synapse Decompiler
  4. -- Purchase Here: https://brack4712.xyz/synapse/purchase/
  5.  
  6. local run = game:GetService("RunService")
  7. local rep = game:GetService("ReplicatedStorage")
  8. local uis = game:GetService("UserInputService")
  9. local starterGui = game:GetService("StarterGui")
  10. local debris = game:GetService("Debris")
  11. local tweenService = game:GetService("TweenService")
  12. local lighting = game:GetService("Lighting")
  13. local market = game:GetService("MarketplaceService")
  14. local spawnLocations = {}
  15. for _, v in next, workspace.SpawnParts:GetChildren() do
  16. spawnLocations[#spawnLocations + 1] = CFrame.new(v.CFrame.p)
  17. end
  18. lighting.Bloom.Intensity = 0.6
  19. starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
  20. starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)
  21. starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
  22. local setCoreDelay = coroutine.wrap(function()
  23. wait()
  24. game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)
  25. end)
  26. setCoreDelay()
  27. local defaultData = require(rep.Modules.DefaultData)
  28. local colorData = require(rep.Modules.ColorData)
  29. local itemData = require(rep.Modules.ItemData)
  30. local levelData = require(rep.Modules.LevelData)
  31. local cosmeticData = require(rep.Modules.CosmeticData)
  32. local patchNotes = require(rep.Modules.PatchNotes)
  33. local player = game.Players.LocalPlayer
  34. local mouse = player:GetMouse()
  35. local char, root, hum, head
  36. local currentWalkSpeed = 16
  37. local charActive = false
  38. local moveAllowed = false
  39. local cam, camFocus, camOffsetMin, camOffsetMax
  40. local camRot = 0
  41. local zoomLevel = 17
  42. local camOffset = Vector3.new(25, 17, -25)
  43. local rmbHeld = false
  44. local dragObject, mouseBoundStructure
  45. local buildingRotation = 0
  46. local selectionTarget
  47. local hasShifted = false
  48. local collisionDetect = Instance.new("Part")
  49. collisionDetect.Transparency = 1
  50. collisionDetect.CanCollide = false
  51. collisionDetect.Anchored = true
  52. collisionDetect.Touched:connect(function()
  53. end)
  54. local anims = {}
  55. ping = 0
  56. data = rep.Events.RequestData:InvokeServer()
  57. game:GetService("ContentProvider"):PreloadAsync(game.ReplicatedStorage.Animations:GetChildren())
  58. local playerGui = player:WaitForChild("PlayerGui")
  59. playerGui:SetTopbarTransparency(1)
  60. local mainGui = playerGui:WaitForChild("MainGui")
  61. local secondaryGui = playerGui:WaitForChild("SecondaryGui")
  62. local spawnGui = playerGui:WaitForChild("SpawnGui")
  63. local backpack = player:WaitForChild("Backpack")
  64. backpack.ChildAdded:connect(function()
  65. player:Kick()
  66. end)
  67. local busyTags = {}
  68. local noteSerializer = 1
  69. local maxNotifications = 3
  70. bodyColorList = {
  71. LeftUpperLeg = true,
  72. LeftLowerLeg = true,
  73. LeftFoot = true,
  74. RightUpperLeg = true,
  75. RightLowerLeg = true,
  76. RightFoot = true,
  77. UpperTorso = true,
  78. LowerTorso = true
  79. }
  80. skinColorList = {
  81. LeftUpperArm = true,
  82. LeftLowerArm = true,
  83. LeftHand = true,
  84. RightUpperArm = true,
  85. RightLowerArm = true,
  86. RightHand = true,
  87. Head = true
  88. }
  89. local chosenColor, chosenWay = nil, "yeet"
  90. mainGui.Primary.Tribe.NewTribe.Frame.Frame.CancelButton.InputBegan:connect(function(input, gp)
  91. if functionBank.InteractInput(input, gp) then
  92. functionBank.TogglePrimaryMenu("Tribe", false)
  93. end
  94. end)
  95. mainGui.LeftPanel.NewTribe.Frame.CreateButton.InputBegan:connect(function(input, gp)
  96. if functionBank.InteractInput(input, gp) and chosenColor and chosenWay then
  97. rep.Events.CreateTribe:FireServer(chosenColor, chosenWay)
  98. rep.Sounds.Quicks.TribeSound:Play()
  99. functionBank.DrawTribeGui()
  100. end
  101. end)
  102. mainGui.LeftPanel.Tribe.LeaveButton.InputBegan:connect(function(input, gp)
  103. if functionBank.InteractInput(input, gp) then
  104. rep.Events.TribeLeave:FireServer()
  105. end
  106. end)
  107. mainGui.LeftPanel.Tribe.TotemButton.InputBegan:connect(function(input, gp)
  108. if functionBank.InteractInput(input, gp) then
  109. local tribeKey, tribeData = functionBank.IsInTribe()
  110. if tribeData and tribeData.chief == player.Name then
  111. if not workspace.Totems:FindFirstChild(tribeData.color .. " Tribe") then
  112. local totemClone = rep.Deployables["Tribe Totem"]:Clone()
  113. functionBank.BindMouseStructure(totemClone)
  114. end
  115. else
  116. functionBank.CreateNotification("Only the Chief can make a Totem!", colorData.badRed, 2)
  117. end
  118. end
  119. end)
  120. mainGui.Primary.Tribe.TribeConsole.Members.InviteButton.InputBegan:connect(function(input, gp)
  121. if functionBank.InteractInput(input, gp) then
  122. mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.Visible = not mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.Visible
  123. if mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.Visible then
  124. for _, v in next, mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.List:GetChildren() do
  125. if v:IsA("TextButton") then
  126. v:Destroy()
  127. end
  128. end
  129. for _, otherPlayer in next, game.Players:GetPlayers() do
  130. do
  131. local playerButton = mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.Templates.TextButton:Clone()
  132. playerButton.Text = otherPlayer.Name
  133. playerButton.Visible = true
  134. playerButton.Parent = mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.List
  135. playerButton.Name = otherPlayer.Name
  136. playerButton.InputBegan:connect(function(input, gp)
  137. if functionBank.InteractInput(input, gp) then
  138. rep.Events.TribeInvite:FireServer(otherPlayer)
  139. for _, v in next, mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.List:GetChildren() do
  140. if v:IsA("TextButton") then
  141. v:Destroy()
  142. end
  143. end
  144. mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.Visible = false
  145. end
  146. end)
  147. end
  148. end
  149. else
  150. for _, v in next, mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.List:GetChildren() do
  151. if v:IsA("TextButton") then
  152. v:Destroy()
  153. end
  154. end
  155. end
  156. end
  157. end)
  158. for _, v in next, mainGui.RightPanel.Inventory.ArmorFrame.Frame:GetChildren() do
  159. if v:IsA("ImageButton") then
  160. v.InputBegan:connect(function(input, gp)
  161. if functionBank.InteractInput(input, gp) and data.armor[v.Name] and data.armor[v.Name] ~= "none" then
  162. rep.Events.UnequipArmor:FireServer(data.armor[v.Name])
  163. end
  164. end)
  165. end
  166. end
  167. secondaryGui.PlayerList.List.ActionPanel.KickButton.InputBegan:connect(function(input, gp)
  168. if functionBank.InteractInput(input, gp) then
  169. local targetPlayerName = secondaryGui.PlayerList.List.ActionPanel.TargetPlayerName.Value
  170. if targetPlayerName then
  171. local targetPlayer = game.Players:FindFirstChild(targetPlayerName)
  172. if targetPlayer then
  173. rep.Events.TribeKick:FireServer(targetPlayer)
  174. secondaryGui.PlayerList.List.ActionPanel.Visible = false
  175. end
  176. end
  177. end
  178. end)
  179. secondaryGui.PlayerList.List.ActionPanel.CancelButton.InputBegan:connect(function(input, gp)
  180. if functionBank.InteractInput(input, gp) then
  181. secondaryGui.PlayerList.List.ActionPanel.Visible = false
  182. end
  183. end)
  184. secondaryGui.PlayerList.List.ActionPanel.InviteButton.InputBegan:connect(function(input, gp)
  185. if functionBank.InteractInput(input, gp) then
  186. rep.Events.TribeInvite:FireServer(game.Players:FindFirstChild(secondaryGui.PlayerList.List.ActionPanel.TargetPlayerName.Value))
  187. secondaryGui.PlayerList.List.ActionPanel.Visible = false
  188. end
  189. end)
  190. for _, button in next, mainGui.LeftPanel.Craft.Selection:GetChildren() do
  191. if button:IsA("ImageButton") then
  192. button.InputBegan:connect(function(input, gp)
  193. if functionBank.InteractInput(input, gp) then
  194. button.BackgroundColor3 = colorData.goodGreen
  195. for _, v in next, mainGui.LeftPanel.Craft.Selection:GetChildren() do
  196. if v:IsA("ImageButton") and v ~= button then
  197. v.BackgroundColor3 = colorData.grey200
  198. end
  199. end
  200. functionBank.DrawCraftMenu(button.Category.Value)
  201. end
  202. end)
  203. end
  204. end
  205. mainGui.LeftPanel.Craft.SearchBar.Changed:connect(function(property)
  206. if property == "Text" then
  207. if mainGui.LeftPanel.Craft.SearchBar.Text == "" then
  208. functionBank.DrawCraftMenu("all")
  209. else
  210. for _, v in next, mainGui.LeftPanel.Craft.Selection:GetChildren() do
  211. if v:IsA("ImageButton") then
  212. v.BackgroundColor3 = colorData.grey200
  213. end
  214. end
  215. functionBank.DrawCraftMenu("all", mainGui.LeftPanel.Craft.SearchBar.Text)
  216. end
  217. end
  218. end)
  219. mainGui.RightPanel.Inventory.RedoAvatarButton.InputBegan:connect(function(input, gp)
  220. if functionBank.InteractInput(input, gp) then
  221. rep.Events.RedoAvatar:FireServer()
  222. end
  223. end)
  224. for _, chestFrame in next, mainGui.LeftPanel.Shop.Lists.ChestList:GetChildren() do
  225. if chestFrame:IsA("Frame") then
  226. chestFrame.OpenButton.InputBegan:connect(function(input, gp)
  227. if functionBank.InteractInput(input, gp) then
  228. if chestFrame.OpenButton.Text ~= "OPEN" then
  229. market:PromptProductPurchase(player, chestFrame.OpenButton.ProductId.Value)
  230. else
  231. rep.Events.ChestDrop:FireServer(chestFrame.Name)
  232. end
  233. end
  234. end)
  235. end
  236. end
  237. local rayIgnore = {}
  238. local lastToast, toastWait = 0, 0
  239. local currentToast = 1
  240. local lastCraftCategory, lastCraftSearch = "all", nil
  241. functionBank = {
  242. NearestTotemAndDistance = function(pos)
  243. local ignoreTotemColor
  244. local tribeKey, tribeData = functionBank.IsInTribe()
  245. if tribeData then
  246. ignoreTotemColor = tribeData.color
  247. end
  248. local closestTotem, closestDistance = nil, math.huge
  249. for _, totem in next, workspace.Totems:GetChildren() do
  250. if totem.TribeColor.Value ~= ignoreTotemColor then
  251. local distance = (totem.PrimaryPart.Position - pos).magnitude
  252. if closestDistance > distance then
  253. closestTotem, closestDistance = totem, distance
  254. end
  255. end
  256. end
  257. return closestTotem, closestDistance
  258. end,
  259. BindMouseStructure = function(item)
  260. mouseBoundStructure = item
  261. for _, v in next, mouseBoundStructure:GetDescendants() do
  262. if v:IsA("BasePart") then
  263. if v.Name == "Reference" or v.Name == "Interactable" or v.Name == "Effect" then
  264. v.Transparency = 1
  265. else
  266. v.Transparency = 0.3
  267. end
  268. v.Material = Enum.Material.Glass
  269. v.CanCollide = false
  270. v.Anchored = true
  271. elseif v:IsA("Weld") or v:IsA("ManualWeld") then
  272. else
  273. v:Destroy()
  274. end
  275. end
  276. local function swapBoundColor(toggle)
  277. if toggle then
  278. if mouseBoundStructure.PrimaryPart.Color == colorData.goodGreen then
  279. return
  280. end
  281. for _, v in next, mouseBoundStructure:GetDescendants() do
  282. if v:IsA("BasePart") then
  283. v.Color = colorData.goodGreen
  284. end
  285. end
  286. else
  287. if mouseBoundStructure.PrimaryPart.BrickColor == colorData.badRed then
  288. return
  289. end
  290. for _, v in next, mouseBoundStructure:GetDescendants() do
  291. if v:IsA("BasePart") then
  292. v.Color = colorData.badRed
  293. end
  294. end
  295. end
  296. end
  297. mouseBoundStructure.Parent = char
  298. while mouseBoundStructure do
  299. mouse.TargetFilter = mouseBoundStructure
  300. local part, pos, norm, mat = functionBank.RayUntil(mouse.Hit.p + Vector3.new(0, 10, 0), Vector3.new(0, -1000, 0))
  301. mouseBoundStructure:SetPrimaryPartCFrame(CFrame.new(pos) * CFrame.Angles(0, math.rad(buildingRotation), 0))
  302. local canPlace = true
  303. if (pos - root.Position).magnitude > 50 then
  304. canPlace = false
  305. end
  306. if part ~= workspace.Terrain and itemData[mouseBoundStructure.Name].placement ~= "all" then
  307. canPlace = false
  308. end
  309. if mat and mat == Enum.Material.Water and itemData[mouseBoundStructure.Name].placement ~= "sea" then
  310. canPlace = false
  311. end
  312. if mat and mat ~= Enum.Material.Water and itemData[mouseBoundStructure.Name].placement == "sea" then
  313. canPlace = false
  314. end
  315. if itemData[mouseBoundStructure.Name].recipe and not functionBank.CanCraftItem(mouseBoundStructure.Name) then
  316. canPlace = false
  317. end
  318. for _, v in next, spawnLocations, nil do
  319. if itemData[mouseBoundStructure.Name].placement ~= "sea" and (pos - v.p).magnitude < 25 then
  320. canPlace = false
  321. end
  322. end
  323. local closestTotem, distance = functionBank.NearestTotemAndDistance(pos)
  324. if distance < 175 then
  325. canPlace = false
  326. end
  327. swapBoundColor(canPlace)
  328. run.RenderStepped:wait()
  329. end
  330. end,
  331. DrawPatchNotes = function()
  332. for _, v in next, mainGui.LeftPanel.PatchNotes.List:GetChildren() do
  333. if v:IsA("TextLabel") then
  334. v:Destroy()
  335. end
  336. end
  337. local serial = 1
  338. for _, noteData in next, patchNotes, nil do
  339. local newHeader = mainGui.LeftPanel.PatchNotes.Templates.Header:Clone()
  340. newHeader.Text = noteData.title
  341. newHeader.LayoutOrder = serial
  342. serial = serial + 1
  343. newHeader.Parent = mainGui.LeftPanel.PatchNotes.List
  344. newHeader.Visible = true
  345. local newTitle = mainGui.LeftPanel.PatchNotes.Templates.Title:Clone()
  346. newTitle.Text = noteData.date
  347. newTitle.LayoutOrder = serial
  348. serial = serial + 1
  349. newTitle.Parent = mainGui.LeftPanel.PatchNotes.List
  350. newTitle.Visible = true
  351. for _, update in next, noteData.updates, nil do
  352. if update.textType == "title" then
  353. local newTitle = mainGui.LeftPanel.PatchNotes.Templates.Title:Clone()
  354. newTitle.Text = update.message
  355. newTitle.LayoutOrder = serial
  356. serial = serial + 1
  357. newTitle.Parent = mainGui.LeftPanel.PatchNotes.List
  358. newTitle.Visible = true
  359. else
  360. local newNote = mainGui.LeftPanel.PatchNotes.Templates.Note:Clone()
  361. newNote.Text = update.message
  362. newNote.LayoutOrder = serial
  363. serial = serial + 1
  364. newNote.Parent = mainGui.LeftPanel.PatchNotes.List
  365. newNote.Visible = true
  366. end
  367. end
  368. end
  369. spawn(function()
  370. mainGui.LeftPanel.PatchNotes.List.CanvasSize = UDim2.new(1, 0, 0, mainGui.LeftPanel.PatchNotes.List.UIListLayout.AbsoluteContentSize.Y)
  371. end)
  372. end,
  373. IsInTribe = function()
  374. local is = false
  375. print("local IsInATribe, tribes table is", tribes)
  376. for tribeKey, tribeData in next, tribes, nil do
  377. if tribeData.chief == player.Name then
  378. return tribeKey, tribeData
  379. end
  380. for _, member in next, tribeData.members, nil do
  381. if member == player.Name then
  382. return tribeKey, tribeData
  383. end
  384. end
  385. end
  386. return nil
  387. end,
  388. UpdatePlayerList = function(playerListData, tribesList)
  389. print("UpdatePlayerList received", playerListData, tribesList)
  390. for _, v in next, secondaryGui.PlayerList.List:GetChildren() do
  391. if v:IsA("Frame") and v.Name ~= "ActionPanel" then
  392. v:Destroy()
  393. end
  394. end
  395. for key, v in next, playerListData, nil do
  396. do
  397. local nameTag = secondaryGui.PlayerList.Templates.Frame:Clone()
  398. nameTag.Name = v.playerName
  399. nameTag.TextLabel.Text = v.playerName
  400. nameTag.ImageLabel.BackgroundColor3 = v.playerColor
  401. local tribeName
  402. for key, col in next, colorData.TribeColors, nil do
  403. if col == v.playerColor then
  404. tribeName = key
  405. end
  406. end
  407. nameTag.ImageLabel.TextLabel.Text = v.playerLevel
  408. nameTag.ImageLabel.Visible = true
  409. nameTag.Name = v.playerName
  410. nameTag.LayoutOrder = (colorData.TribeOffsets[tribeName] or 0) + string.byte(string.sub(v.playerName, 1, 1))
  411. nameTag.Parent = secondaryGui.PlayerList.List
  412. nameTag.Visible = true
  413. nameTag.ImageButton.InputBegan:connect(function(input, gp)
  414. if functionBank.InteractInput(input, gp) then
  415. local menuType = "none"
  416. local tribeInfo
  417. for tribeKey, tribeData in next, tribesList, nil do
  418. local member
  419. for _, v in next, tribeData.members, nil do
  420. if v == player.Name then
  421. member = true
  422. end
  423. end
  424. if member then
  425. menuType = "member"
  426. tribeInfo = tribeData
  427. break
  428. elseif tribeData.chief == player.Name then
  429. menuType = "chief"
  430. tribeInfo = tribeData
  431. break
  432. else
  433. menuType = "none"
  434. end
  435. end
  436. secondaryGui.PlayerList.List.ActionPanel.KickButton.Visible = false
  437. secondaryGui.PlayerList.List.ActionPanel.InviteButton.Visible = false
  438. if menuType == "chief" then
  439. secondaryGui.PlayerList.List.ActionPanel.KickButton.Visible = true
  440. end
  441. if menuType == "chief" or menuType == "member" then
  442. secondaryGui.PlayerList.List.ActionPanel.InviteButton.Visible = true
  443. end
  444. secondaryGui.PlayerList.List.ActionPanel.Visible = true
  445. secondaryGui.PlayerList.List.ActionPanel.TargetPlayerName.Value = nameTag.Name
  446. secondaryGui.PlayerList.List.ActionPanel.LayoutOrder = nameTag.LayoutOrder + 1
  447. end
  448. end)
  449. if secondaryGui.PlayerList.List.ActionPanel.Visible and secondaryGui.PlayerList.List.ActionPanel.TargetPlayerName.Value and secondaryGui.PlayerList.List:FindFirstChild(secondaryGui.PlayerList.List.ActionPanel.TargetPlayerName.Value) then
  450. secondaryGui.PlayerList.List.ActionPanel.LayoutOrder = secondaryGui.PlayerList.List:FindFirstChild(secondaryGui.PlayerList.List.ActionPanel.TargetPlayerName.Value).LayoutOrder + 1
  451. end
  452. end
  453. end
  454. end,
  455. UpdateArmor = function()
  456. for locus, armorName in next, data.armor, nil do
  457. if armorName and armorName ~= "none" then
  458. mainGui.RightPanel.Inventory.ArmorFrame.Frame[locus].Image = itemData[armorName].image
  459. mainGui.RightPanel.Inventory.ArmorFrame.Frame[locus].DefaultIcon.ImageTransparency = 1
  460. else
  461. mainGui.RightPanel.Inventory.ArmorFrame.Frame[locus].Image = ""
  462. mainGui.RightPanel.Inventory.ArmorFrame.Frame[locus].DefaultIcon.ImageTransparency = 0
  463. end
  464. end
  465. end,
  466. UpdateMimic = function()
  467. for limbName, val in next, skinColorList, nil do
  468. char:FindFirstChild(limbName).Color = cosmeticData.skinColors[data.appearance.skin]
  469. end
  470. char.Head.Face.Texture = cosmeticData.faceIds[data.appearance.face]
  471. for _, v in next, char:GetChildren() do
  472. if v.Name == "Hair" then
  473. v:Destroy()
  474. end
  475. end
  476. if data.appearance.hair ~= "Bald" then
  477. local newHair = rep.Cosmetics.Hair:FindFirstChild(data.appearance.hair):Clone()
  478. local weld = Instance.new("Weld")
  479. weld.Parent = newHair
  480. newHair.CFrame = char.Head.CFrame
  481. weld.Part0 = newHair
  482. weld.Part1 = char.Head
  483. weld.C0 = CFrame.new(0, 0, 0)
  484. newHair.Name = "Hair"
  485. newHair.Parent = char
  486. end
  487. end,
  488. MakeToast = function(toastData)
  489. local title, message, color, image, duration = toastData.title, toastData.message, toastData.color, toastData.image, toastData.duration
  490. if tick() - lastToast < toastWait then
  491. repeat
  492. wait(math.random() / 30)
  493. until tick() - lastToast >= toastWait
  494. end
  495. lastToast = tick()
  496. toastWait = duration + 2
  497. currentToast = currentToast + 1
  498. local toastId = currentToast
  499. local toastFrame = mainGui.Panels.Toasts
  500. toastFrame.Message.Text = ""
  501. toastFrame.Title.Text = title
  502. toastFrame.ImageLabel.Image = image
  503. toastFrame.ImageLabel.BackgroundColor3 = color
  504. toastFrame.Message.TextColor3 = color
  505. toastFrame:TweenPosition(UDim2.new(1, 0, 0.75, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 1, true)
  506. wait(1)
  507. for i = 1, #message do
  508. toastFrame.Message.Text = string.sub(message, 1, i)
  509. rep.Sounds.Quicks.Text:Play()
  510. wait(0.04)
  511. end
  512. wait(duration)
  513. if currentToast == toastId then
  514. toastFrame:TweenPosition(UDim2.new(1.5, 0, 0.75, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 1, true)
  515. end
  516. end,
  517. RayUntil = function(origin, destination)
  518. local ray = Ray.new(origin, destination)
  519. local part, pos, norm, mat = workspace:FindPartOnRayWithIgnoreList(ray, rayIgnore)
  520. if part and part ~= workspace.Terrain then
  521. table.insert(rayIgnore, part)
  522. return functionBank.RayUntil(origin, destination)
  523. end
  524. rayIgnore = {}
  525. return part, pos, norm, mat
  526. end,
  527. CreateParticles = function(instance, origin, facing, count, duration, particleProperties)
  528. local part = Instance.new("Part")
  529. part.Anchored = true
  530. part.CanCollide = false
  531. part.Transparency = 1
  532. part.Size = Vector3.new(0, 0, 0)
  533. part.CFrame = CFrame.new(origin, facing)
  534. local emitter = instance:Clone()
  535. emitter.Parent = part
  536. emitter.EmissionDirection = Enum.NormalId.Front
  537. if particleProperties then
  538. for property, val in next, particleProperties, nil do
  539. emitter[property] = val
  540. end
  541. end
  542. part.Parent = workspace
  543. wait()
  544. if count then
  545. emitter.Rate = 0
  546. emitter:Emit(count)
  547. debris:AddItem(part, duration)
  548. else
  549. debris:AddItem(part, duration)
  550. end
  551. end,
  552. CollectPart = function(obj)
  553. local duration = 0.2
  554. if obj:IsA("BasePart") then
  555. local newObj = obj:Clone()
  556. newObj:ClearAllChildren()
  557. newObj.CanCollide = false
  558. newObj.Anchored = true
  559. obj:Destroy()
  560. newObj.Parent = cam
  561. local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0)
  562. local goals = {
  563. CFrame = root.CFrame,
  564. Size = Vector3.new(0.6, 0.6, 0.6),
  565. Transparency = 1
  566. }
  567. local tween = tweenService:Create(newObj, tweenInfo, goals)
  568. tween:Play()
  569. debris:AddItem(newObj, duration)
  570. else
  571. obj:Destroy()
  572. end
  573. end,
  574. CleanNils = function(tab)
  575. local newTab = {}
  576. for _, v in next, tab, nil do
  577. newTab[#newTab + 1] = v
  578. end
  579. return newTab
  580. end,
  581. AppendTables = function(tables)
  582. local mainTable = {}
  583. for tabKey, tabData in next, tables, nil do
  584. for key, val in next, tabData, nil do
  585. mainTable[#mainTable + 1] = val
  586. end
  587. end
  588. return mainTable
  589. end,
  590. DrawTribeGui = function()
  591. tribes = rep.Events.RequestTribeData:InvokeServer()
  592. local tribeKey, tribeData = functionBank.IsInTribe()
  593. if tribeKey then
  594. mainGui.LeftPanel.Tribe.Chief.ImageLabel.BackgroundColor3 = colorData.TribeColors[tribeData.color]
  595. mainGui.LeftPanel.Tribe.Chief.Message.TextColor3 = colorData.TribeColors[tribeData.color]
  596. if tribeData.message ~= "" then
  597. mainGui.LeftPanel.Tribe.Chief.Message.Text = "\"" .. tribeData.message .. "\""
  598. else
  599. mainGui.LeftPanel.Tribe.Chief.Message.Text = ""
  600. end
  601. mainGui.LeftPanel.Tribe.Members.MembersTitle.Text = "MEMBERS"
  602. mainGui.LeftPanel.Tribe.Members.MembersTitle.BackgroundColor3 = colorData.TribeColors[tribeData.color]
  603. mainGui.LeftPanel.Tribe.Title.Text = string.upper(tribeData.color) .. " TRIBE"
  604. mainGui.LeftPanel.Tribe.Title.TextColor3 = colorData.TribeColors[tribeData.color]
  605. for _, v in next, mainGui.LeftPanel.Tribe.Members.Frame.List:GetChildren() do
  606. if v:IsA("TextButton") then
  607. v:Destroy()
  608. end
  609. end
  610. local chiefButton = mainGui.LeftPanel.Tribe.Members.Frame.Templates.TextButton:Clone()
  611. chiefButton.BackgroundColor3 = colorData.TribeColors[tribeData.color]
  612. chiefButton.Text = "Chief " .. tribeData.chief
  613. chiefButton.Parent = mainGui.LeftPanel.Tribe.Members.Frame.List
  614. chiefButton.Visible = true
  615. for _, v in next, tribeData.members, nil do
  616. local memberButton = mainGui.LeftPanel.Tribe.Members.Frame.Templates.TextButton:Clone()
  617. memberButton.Text = v
  618. memberButton.Parent = mainGui.LeftPanel.Tribe.Members.Frame.List
  619. memberButton.Visible = true
  620. end
  621. end
  622. end,
  623. CreateSound = function(sound, parent, waver)
  624. sound = sound:Clone()
  625. sound.Parent = parent
  626. if waver then
  627. sound.Pitch = sound.Pitch + (sound.DefaultPitch.Value or 1) * (math.random(-25, 25) / 100)
  628. end
  629. repeat
  630. if not (sound.TimeLength > 0) then
  631. wait()
  632. else
  633. end
  634. until sound.TimeLength > 0
  635. sound:Play()
  636. wait()
  637. debris:AddItem(sound, sound.TimeLength)
  638. end,
  639. CreateNotification = function(text, color, duration)
  640. duration = duration or 1
  641. local fadeLength = 2
  642. local totalNotes = #mainGui.Subordinates.Notifications:GetChildren() - 2
  643. if totalNotes >= maxNotifications then
  644. local lowestNote, noteLevel = nil, math.huge
  645. for _, v in next, mainGui.Subordinates.Notifications:GetChildren() do
  646. if v:IsA("TextLabel") and noteLevel > v.LayoutOrder then
  647. lowestNote, noteLevel = v, v.LayoutOrder
  648. end
  649. end
  650. if lowestNote then
  651. lowestNote:Destroy()
  652. end
  653. end
  654. local notification = mainGui.Subordinates.Notifications.Templates.TextLabel:Clone()
  655. notification.Text = text
  656. notification.TextColor3 = color or Color3.fromRGB(255, 255, 255)
  657. notification.LayoutOrder = noteSerializer
  658. noteSerializer = noteSerializer + 1
  659. notification.Parent = mainGui.Subordinates.Notifications
  660. notification.Visible = true
  661. debris:AddItem(notification, duration + fadeLength)
  662. local tweenInfo = TweenInfo.new(fadeLength, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, duration or 1)
  663. local goals = {
  664. BackgroundTransparency = 1,
  665. TextTransparency = 1,
  666. TextStrokeTransparency = 1
  667. }
  668. local tween = tweenService:Create(notification, tweenInfo, goals)
  669. tween:Play()
  670. end,
  671. UpdateBillboards = function(clear)
  672. if selectionTarget then
  673. do
  674. local gui = playerGui:FindFirstChild(selectionTarget.Name)
  675. if gui then
  676. if clear then
  677. gui:Destroy()
  678. selectionTarget = nil
  679. return
  680. end
  681. for _, v in next, gui.Frame.List:GetChildren() do
  682. if v:IsA("ImageButton") then
  683. v:Destroy()
  684. end
  685. end
  686. if gui.Name == "Campfire" then
  687. for _, v in next, data.inventory, nil do
  688. if itemData[v.name].fuels then
  689. do
  690. local button = gui.Frame.Templates.ImageButton:Clone()
  691. button.Image = itemData[v.name].image
  692. button.TextLabel.Text = v.quantity
  693. button.Name = v.name
  694. button.Parent = gui.Frame.List
  695. button.Visible = true
  696. button.MouseButton1Down:connect(function()
  697. rep.Events.InteractStructure:FireServer(selectionTarget, button.Name)
  698. rep.Sounds.Quicks.Click3:Play()
  699. selectionTarget.Board.Billboard.Backdrop.TextLabel.Text = math.floor(tonumber(selectionTarget.Board.Billboard.Backdrop.TextLabel.Text) + 0.5)
  700. selectionTarget.Board.Billboard.Backdrop.Slider.Size = UDim2.new(tonumber(selectionTarget.Board.Billboard.Backdrop.TextLabel.Text) / itemData[selectionTarget.Name].capacity, 0, 1, 0)
  701. selectionTarget.Board.Billboard.Backdrop.Slider.BackgroundColor3 = Color3.fromRGB(255, 0, 0):lerp(Color3.fromRGB(170, 255, 0), selectionTarget.Board.Billboard.Backdrop.TextLabel.Text / 100)
  702. if tonumber(selectionTarget.Board.Billboard.Backdrop.TextLabel.Text) >= itemData[selectionTarget.Name].capacity * 0.95 then
  703. gui:Destroy()
  704. selectionTarget = nil
  705. return
  706. end
  707. end)
  708. end
  709. end
  710. end
  711. elseif gui.Name == "Plant Box" then
  712. for _, v in next, data.inventory, nil do
  713. if itemData[v.name] and itemData[v.name].grows then
  714. do
  715. local button = gui.Frame.Templates.ImageButton:Clone()
  716. button.Image = itemData[v.name].image
  717. button.TextLabel.Text = v.quantity
  718. button.Name = v.name
  719. button.Parent = gui.Frame.List
  720. button.Visible = true
  721. button.MouseButton1Down:connect(function()
  722. rep.Events.InteractStructure:FireServer(selectionTarget, button.Name)
  723. rep.Sounds.Quicks.Click3:Play()
  724. end)
  725. end
  726. end
  727. end
  728. elseif gui.Name == "Grinder" then
  729. for _, v in next, data.inventory, nil do
  730. if itemData[v.name].grindsTo then
  731. do
  732. local button = gui.Frame.Templates.ImageButton:Clone()
  733. button.Image = itemData[v.name].image
  734. button.TextLabel.Text = v.quantity
  735. button.Name = v.name
  736. button.Parent = gui.Frame.List
  737. button.Visible = true
  738. button.MouseButton1Down:connect(function()
  739. rep.Events.InteractStructure:FireServer(selectionTarget, button.Name)
  740. rep.Sounds.Quicks.Click3:Play()
  741. end)
  742. end
  743. end
  744. end
  745. end
  746. else
  747. return
  748. end
  749. end
  750. end
  751. end,
  752. UpdateStats = function()
  753. mainGui.Panels.Stats.List.Food.Slider.Size = UDim2.new(data.stats.food / 100, 0, 1, 0)
  754. if hum then
  755. mainGui.Panels.Stats.List.Health.Slider.Size = UDim2.new(math.clamp(hum.Health / hum.MaxHealth, 0, 1), 0, 1, 0)
  756. end
  757. local playerLoad, maxLoad = functionBank.CalculateLoad()
  758. mainGui.Panels.Stats.List.Bag.Slider.Size = UDim2.new(math.clamp(playerLoad / maxLoad, 0, 1), 0, 1, 0)
  759. mainGui.Panels.Topbar.EssenceFrame.Frame.TextLabel.Text = "lvl " .. data.level
  760. local nextLevelCost = levelData[data.level] or math.huge
  761. mainGui.Panels.Topbar.EssenceFrame.Frame.Bar.Slider.Size = UDim2.new(data.essence / nextLevelCost, 0, 1, 0)
  762. if player.Character and player.Character:FindFirstChild("HumanoidRootPart") and not player.Character.PrimaryPart.CanCollide then
  763. player:Kick()
  764. end
  765. end,
  766. HasItem = function(itemName)
  767. for key, v in next, data.inventory, nil do
  768. if v.name == itemName then
  769. return key
  770. end
  771. end
  772. return false
  773. end,
  774. CanCraftItem = function(itemName)
  775. local itemInfo = itemData[itemName]
  776. local canCraft = true
  777. for ingredientName, ingredientQuantity in next, itemInfo.recipe, nil do
  778. local hasKey = functionBank.HasItem(ingredientName)
  779. if hasKey then
  780. if ingredientQuantity > data.inventory[hasKey].quantity then
  781. canCraft = false
  782. end
  783. else
  784. canCraft = false
  785. end
  786. end
  787. return canCraft
  788. end,
  789. CalculateLoad = function()
  790. local playerLoad = 0
  791. local maxLoad
  792. if data.armor.bag and data.armor.bag ~= "none" then
  793. maxLoad = itemData[data.armor.bag].maxLoad
  794. else
  795. maxLoad = 100
  796. end
  797. for _, v in next, data.inventory, nil do
  798. if v.quantity and itemData[v.name] then
  799. playerLoad = playerLoad + v.quantity * (itemData[v.name].load or 0)
  800. end
  801. end
  802. return playerLoad, maxLoad
  803. end,
  804. CanBearLoad = function(itemName)
  805. local anticipatedLoad = itemData[itemName].load or 0
  806. local playerLoad, maxLoad = functionBank.CalculateLoad()
  807. if maxLoad >= playerLoad + anticipatedLoad then
  808. return true
  809. else
  810. return false
  811. end
  812. end,
  813. OpenGui = function(card)
  814. if not card then
  815. secondaryGui.PlayerList.Visible = true
  816. local toClose = functionBank.AppendTables({
  817. mainGui.RightPanel:GetChildren(),
  818. mainGui.LeftPanel:GetChildren()
  819. })
  820. for _, v in next, toClose, nil do
  821. if v:IsA("Frame") then
  822. v.Visible = false
  823. end
  824. end
  825. for _, v in next, mainGui.Panels.Card.List:GetChildren() do
  826. if v:IsA("Frame") then
  827. v.ImageButton.BackgroundColor3 = colorData.ironGrey
  828. v.Status.Value = false
  829. end
  830. end
  831. return
  832. end
  833. if card.Status.Value then
  834. secondaryGui.PlayerList.Visible = true
  835. local toClose = functionBank.AppendTables({
  836. mainGui.RightPanel:GetChildren(),
  837. mainGui.LeftPanel:GetChildren()
  838. })
  839. for _, v in next, toClose, nil do
  840. if v:IsA("Frame") then
  841. v.Visible = false
  842. end
  843. end
  844. for _, v in next, mainGui.Panels.Card.List:GetChildren() do
  845. if v:IsA("Frame") then
  846. v.ImageButton.BackgroundColor3 = colorData.ironGrey
  847. v.Status.Value = false
  848. end
  849. end
  850. else
  851. local toClose = functionBank.AppendTables({
  852. mainGui.RightPanel:GetChildren(),
  853. mainGui.LeftPanel:GetChildren()
  854. })
  855. for _, v in next, toClose, nil do
  856. if v:IsA("Frame") then
  857. v.Visible = false
  858. end
  859. end
  860. for _, v in next, mainGui.Panels.Card.List:GetChildren() do
  861. if v:IsA("Frame") then
  862. v.ImageButton.BackgroundColor3 = colorData.ironGrey
  863. v.Status.Value = false
  864. end
  865. end
  866. secondaryGui.PlayerList.Visible = true
  867. for _, pointer in next, card.Opens:GetChildren() do
  868. pointer.Value.Visible = true
  869. if pointer.Value:IsDescendantOf(mainGui.RightPanel) then
  870. secondaryGui.PlayerList.Visible = false
  871. end
  872. if pointer.Value == mainGui.LeftPanel.Tribe then
  873. local tribeKey, tribeData = functionBank.IsInTribe()
  874. if not tribeKey then
  875. print("not in a tribe ree")
  876. pointer.Value.Visible = false
  877. mainGui.LeftPanel.NewTribe.Visible = true
  878. for _, v in next, mainGui.LeftPanel.NewTribe.Frame.Frame.ColorList:GetChildren() do
  879. if v:IsA("ImageButton") then
  880. v:Destroy()
  881. end
  882. end
  883. for colorName, colorRGB in next, colorData.TribeColors, nil do
  884. do
  885. local colorButton = mainGui.LeftPanel.NewTribe.Frame.Frame.Templates.ImageButton:Clone()
  886. for _, tribeData in next, tribes, nil do
  887. if tribeData.color == colorName then
  888. local possibleChief = game.Players:FindFirstChild(tribeData.chief or "")
  889. if possibleChief then
  890. colorButton.Image = "https://web.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userid=" .. possibleChief.UserId
  891. end
  892. end
  893. end
  894. colorButton.BackgroundColor3 = colorRGB
  895. colorButton.Visible = true
  896. colorButton.Parent = mainGui.LeftPanel.NewTribe.Frame.Frame.ColorList
  897. colorButton.InputBegan:connect(function(input, gp)
  898. if functionBank.InteractInput(input, gp) then
  899. chosenColor = colorName
  900. mainGui.LeftPanel.NewTribe.Frame.ColorTitle.BackgroundColor3 = colorRGB
  901. mainGui.LeftPanel.NewTribe.Frame.ColorTitle.TextColor3 = colorRGB
  902. mainGui.LeftPanel.NewTribe.Frame.ColorTitle.Text = string.upper(colorName)
  903. for _, v in next, mainGui.LeftPanel.NewTribe.Frame.Frame.ColorList:GetChildren() do
  904. if v:IsA("ImageButton") then
  905. if v.BackgroundColor3 ~= colorRGB then
  906. v.BorderSizePixel = 0
  907. else
  908. v.BorderSizePixel = 5
  909. end
  910. end
  911. end
  912. end
  913. end)
  914. end
  915. end
  916. end
  917. end
  918. end
  919. card.ImageButton.BackgroundColor3 = colorData.goodGreen
  920. card.Status.Value = true
  921. end
  922. end,
  923. PreQuantity = function(itemName)
  924. local preQuantity = 0
  925. for _, v in next, data.inventory, nil do
  926. if v.name == itemName and v.quantity then
  927. preQuantity = v.quantity
  928. return preQuantity
  929. end
  930. end
  931. return 0
  932. end,
  933. InteractInput = function(input, gp)
  934. if gp then
  935. return
  936. end
  937. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch or input.KeyCode == Enum.KeyCode.ButtonA then
  938. return true
  939. else
  940. return false
  941. end
  942. end,
  943. UpdateCraftMenu = function()
  944. for _, newFrame in next, mainGui.LeftPanel.Craft.List:GetChildren() do
  945. if newFrame:IsA("Frame") and newFrame.Name ~= "LockedFrame" then
  946. local itemName, itemInfo = newFrame.Name, itemData[newFrame.Name]
  947. local canCraft = true
  948. for _, ingredientFrame in next, newFrame.IngredientsList:GetChildren() do
  949. if ingredientFrame:IsA("Frame") then
  950. local ingredientName, ingredientQuantity = ingredientFrame.Name, itemInfo.recipe[ingredientFrame.Name]
  951. local hasKey = functionBank.HasItem(ingredientName)
  952. if hasKey then
  953. if ingredientQuantity > data.inventory[hasKey].quantity then
  954. canCraft = false
  955. ingredientFrame.IngredientName.BackgroundColor3 = colorData.badRed
  956. else
  957. ingredientFrame.IngredientName.BackgroundColor3 = colorData.goodGreen
  958. end
  959. else
  960. canCraft = false
  961. ingredientFrame.IngredientName.BackgroundColor3 = colorData.badRed
  962. end
  963. end
  964. end
  965. if canCraft then
  966. newFrame.CraftButton.BackgroundColor3 = colorData.goodGreen
  967. newFrame.CraftButton.Text = ">"
  968. else
  969. newFrame.CraftButton.BackgroundColor3 = colorData.badRed
  970. newFrame.CraftButton.Text = "X"
  971. end
  972. end
  973. end
  974. end,
  975. DrawCraftMenu = function(category, phrase)
  976. for _, v in next, mainGui.LeftPanel.Craft.List:GetChildren() do
  977. if v:IsA("Frame") then
  978. v:Destroy()
  979. end
  980. end
  981. for itemName, itemInfo in next, itemData, nil do
  982. do
  983. local relevant = true
  984. if not itemInfo.recipe then
  985. relevant = false
  986. end
  987. if category and category ~= "all" and itemInfo.itemType ~= category then
  988. relevant = false
  989. end
  990. if phrase and not itemName:lower():match(phrase:lower()) then
  991. relevant = false
  992. end
  993. if relevant then
  994. if itemInfo.craftLevel <= data.level then
  995. local newFrame = mainGui.LeftPanel.Craft.Templates.ItemFrame:Clone()
  996. newFrame.ImageLabel.Image = itemInfo.image
  997. newFrame.Title.Text = itemName
  998. newFrame.Name = itemName
  999. local canCraft = true
  1000. for ingredientName, ingredientQuantity in next, itemInfo.recipe, nil do
  1001. local ingredientFrame = mainGui.LeftPanel.Craft.Templates.Ingredient:Clone()
  1002. ingredientFrame.ImageLabel.Image = itemData[ingredientName].image
  1003. ingredientFrame.IngredientName.Text = ingredientQuantity .. " " .. ingredientName
  1004. ingredientFrame.Name = ingredientName
  1005. local hasKey = functionBank.HasItem(ingredientName)
  1006. if hasKey then
  1007. if data.inventory[hasKey].quantity then
  1008. if ingredientQuantity <= data.inventory[hasKey].quantity then
  1009. ingredientFrame.IngredientName.BackgroundColor3 = colorData.goodGreen
  1010. else
  1011. ingredientFrame.IngredientName.BackgroundColor3 = colorData.badRed
  1012. canCraft = false
  1013. end
  1014. else
  1015. end
  1016. else
  1017. canCraft = false
  1018. end
  1019. ingredientFrame.Parent = newFrame.IngredientsList
  1020. ingredientFrame.Visible = true
  1021. end
  1022. if canCraft then
  1023. newFrame.CraftButton.Text = ">"
  1024. newFrame.CraftButton.BackgroundColor3 = colorData.goodGreen
  1025. else
  1026. newFrame.CraftButton.Text = "X"
  1027. newFrame.CraftButton.BackgroundColor3 = colorData.badRed
  1028. end
  1029. newFrame.CraftButton.InputBegan:connect(function(input, gp)
  1030. if functionBank.InteractInput(input, gp) and functionBank.CanCraftItem(itemName) then
  1031. if itemInfo.deployable then
  1032. functionBank.OpenGui()
  1033. if dragObject then
  1034. dragObject = nil
  1035. end
  1036. functionBank.BindMouseStructure(rep.Deployables:FindFirstChild(itemName):Clone())
  1037. else
  1038. rep.Events.CraftItem:FireServer(itemName)
  1039. end
  1040. end
  1041. end)
  1042. newFrame.LayoutOrder = itemInfo.craftLevel
  1043. newFrame.Parent = mainGui.LeftPanel.Craft.List
  1044. newFrame.Visible = true
  1045. else
  1046. local lockedFrame = mainGui.LeftPanel.Craft.Templates.LockedFrame:Clone()
  1047. lockedFrame.LockedLabel.Text = "LOCKED [" .. itemInfo.craftLevel .. "]"
  1048. lockedFrame.Title.Text = itemName
  1049. lockedFrame.LayoutOrder = 100 + itemInfo.craftLevel
  1050. lockedFrame.Parent = mainGui.LeftPanel.Craft.List
  1051. lockedFrame.Visible = true
  1052. end
  1053. else
  1054. end
  1055. end
  1056. end
  1057. local foundFrame = mainGui.LeftPanel.Craft.List:FindFirstChildOfClass("Frame")
  1058. local offset
  1059. if foundFrame then
  1060. offset = foundFrame.AbsoluteSize.Y + 15
  1061. else
  1062. offset = 15
  1063. end
  1064. mainGui.LeftPanel.Craft.List.CanvasSize = UDim2.new(1, 0, 0, #mainGui.LeftPanel.Craft.List:GetChildren() * offset)
  1065. end,
  1066. DrawInventory = function()
  1067. for _, chestFrame in next, mainGui.LeftPanel.Shop.Lists.ChestList:GetChildren() do
  1068. if chestFrame:IsA("Frame") then
  1069. local count = 0
  1070. local hasKey = functionBank.HasItem(chestFrame.Name)
  1071. if hasKey then
  1072. count = data.inventory[hasKey].quantity
  1073. end
  1074. chestFrame.Quantity.Text = count
  1075. if count > 0 then
  1076. chestFrame.OpenButton.Text = "OPEN"
  1077. chestFrame.OpenButton.BackgroundColor3 = colorData.goodGreen
  1078. chestFrame.Quantity.TextColor3 = colorData.goodGreen
  1079. else
  1080. chestFrame.OpenButton.Text = "BUY"
  1081. chestFrame.OpenButton.BackgroundColor3 = colorData.essenceYellow
  1082. chestFrame.Quantity.TextColor3 = Color3.fromRGB(255, 255, 255)
  1083. end
  1084. end
  1085. end
  1086. for _, categoryFrame in next, mainGui.RightPanel.Inventory.List:GetChildren() do
  1087. if categoryFrame:IsA("Frame") then
  1088. for _, v in next, categoryFrame:GetChildren() do
  1089. if v:IsA("Frame") then
  1090. v:Destroy()
  1091. end
  1092. end
  1093. end
  1094. end
  1095. for itemKey, itemInfo in next, data.inventory, nil do
  1096. if itemInfo.itemType ~= "chestDrop" then
  1097. do
  1098. local newFrame = mainGui.RightPanel.Inventory.Templates.ItemFrame:Clone()
  1099. if not itemData[itemInfo.name] then
  1100. print(itemInfo.name, "has no image")
  1101. end
  1102. newFrame.ImageButton.Image = itemData[itemInfo.name].image
  1103. newFrame.Name = itemInfo.name
  1104. newFrame.ImageButton.InputBegan:connect(function(input, gp)
  1105. if functionBank.InteractInput(input, gp) then
  1106. rep.Events.UseBagItem:FireServer(itemInfo.name)
  1107. if itemData[itemInfo.name].nourishment then
  1108. functionBank.CreateSound(rep.Sounds.Quicks.Eat, player.PlayerGui, true)
  1109. end
  1110. elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
  1111. rep.Events.DropBagItem:FireServer(itemInfo.name)
  1112. end
  1113. end)
  1114. newFrame.ItemNameLabel.Text = itemInfo.name
  1115. newFrame.ItemNameLabel.Visible = false
  1116. newFrame.ImageButton.MouseEnter:connect(function()
  1117. newFrame.ItemNameLabel.Visible = true
  1118. end)
  1119. newFrame.ImageButton.MouseLeave:connect(function()
  1120. newFrame.ItemNameLabel.Visible = false
  1121. end)
  1122. if itemInfo.quantity and 0 < itemInfo.quantity then
  1123. newFrame.Quantity.Text = itemInfo.quantity
  1124. end
  1125. if itemData[itemInfo.name].itemType == "armor" then
  1126. newFrame.Parent = mainGui.RightPanel.Inventory.List.ArmorFrame
  1127. elseif itemData[itemInfo.name].itemType == "food" then
  1128. newFrame.Parent = mainGui.RightPanel.Inventory.List.FoodFrame
  1129. elseif itemData[itemInfo.name].itemType == "object" then
  1130. newFrame.Parent = mainGui.RightPanel.Inventory.List.ObjectFrame
  1131. elseif itemData[itemInfo.name].itemType == "tool" then
  1132. newFrame.Parent = mainGui.RightPanel.Inventory.List.ToolFrame
  1133. elseif itemData[itemInfo.name].itemType == "dropChest" then
  1134. newFrame:Destroy()
  1135. else
  1136. newFrame.Parent = mainGui.RightPanel.Inventory.List.MiscFrame
  1137. end
  1138. newFrame.Visible = true
  1139. end
  1140. end
  1141. end
  1142. for _, categoryFrame in next, mainGui.RightPanel.Inventory.List:GetChildren() do
  1143. if categoryFrame:IsA("Frame") then
  1144. local frameSize = 100
  1145. local totalFrames = #categoryFrame:GetChildren() - 1
  1146. local numInRow = math.floor(categoryFrame.AbsoluteSize.X / 100)
  1147. local columns = math.ceil(totalFrames / numInRow)
  1148. categoryFrame.Size = UDim2.new(1, 0, 0, columns * 100)
  1149. end
  1150. end
  1151. functionBank.UpdateBillboards()
  1152. end,
  1153. ToggleBusyTag = function(thing, toggle)
  1154. if toggle then
  1155. busyTags[thing] = tick()
  1156. elseif busyTags[thing] then
  1157. busyTags[thing] = nil
  1158. end
  1159. end,
  1160. ClearBetweenPoints = function(pos1, pos2, ignoreTable)
  1161. local ray = Ray.new(pos1, pos2 - pos1)
  1162. local part, pos, norm, mat = workspace:FindPartOnRayWithIgnoreList(ray, ignoreTable)
  1163. if part then
  1164. return false
  1165. else
  1166. return true
  1167. end
  1168. end,
  1169. GetDictionaryLength = function(tab)
  1170. local count = 0
  1171. for _, v in next, tab, nil do
  1172. count = count + 1
  1173. end
  1174. return count
  1175. end,
  1176. SortToolbar = function()
  1177. for _, v in next, mainGui.Panels.Toolbar.List:GetChildren() do
  1178. if v:IsA("ImageButton") then
  1179. if functionBank.GetDictionaryLength(data.toolbar[tonumber(v.Name)]) > 0 then
  1180. v.Image = itemData[data.toolbar[tonumber(v.Name)].name].image
  1181. else
  1182. v.Image = ""
  1183. end
  1184. if tonumber(v.Name) == data.equipped then
  1185. v.BackgroundColor3 = colorData.goodGreen
  1186. else
  1187. v.BackgroundColor3 = colorData.ironGrey
  1188. end
  1189. end
  1190. end
  1191. if not data.equipped then
  1192. mainGui.Panels.Toolbar.Title.Visible = false
  1193. elseif 0 < functionBank.GetDictionaryLength(data.toolbar[data.equipped]) then
  1194. mainGui.Panels.Toolbar.Title.Visible = true
  1195. mainGui.Panels.Toolbar.Title.Text = string.upper(data.toolbar[data.equipped].name)
  1196. end
  1197. end
  1198. }
  1199. functionBank.SortToolbar()
  1200. functionBank.DrawInventory()
  1201. functionBank.DrawCraftMenu()
  1202. functionBank.DrawTribeGui()
  1203. functionBank.DrawPatchNotes()
  1204. functionBank.OpenGui(mainGui.Panels.Card.List.PatchNotes)
  1205. functionBank.UpdateStats()
  1206. for _, v in next, spawnGui.Customization.Appearance.HairFrame:GetChildren() do
  1207. if v:IsA("ImageButton") then
  1208. v.InputBegan:connect(function(input, gp)
  1209. if functionBank.InteractInput(input, gp) then
  1210. data.appearance.hair = v.Name
  1211. rep.Events.CosmeticChange:FireServer(data.appearance)
  1212. functionBank.UpdateMimic()
  1213. end
  1214. end)
  1215. end
  1216. end
  1217. for _, v in next, spawnGui.Customization.Appearance.GenderFrame:GetChildren() do
  1218. if v:IsA("ImageButton") then
  1219. v.InputBegan:connect(function(input, gp)
  1220. if functionBank.InteractInput(input, gp) then
  1221. data.appearance.gender = v.Name
  1222. rep.Events.CosmeticChange:FireServer(data.appearance)
  1223. functionBank.UpdateMimic()
  1224. end
  1225. end)
  1226. end
  1227. end
  1228. for _, v in next, spawnGui.Customization.Appearance.SkinFrame:GetChildren() do
  1229. if v:IsA("ImageButton") then
  1230. v.InputBegan:connect(function(input, gp)
  1231. if functionBank.InteractInput(input, gp) then
  1232. data.appearance.skin = v.Name
  1233. rep.Events.CosmeticChange:FireServer(data.appearance)
  1234. functionBank.UpdateMimic()
  1235. end
  1236. end)
  1237. end
  1238. end
  1239. for _, v in next, spawnGui.Customization.Appearance.FaceFrame:GetChildren() do
  1240. if v:IsA("ImageButton") then
  1241. v.InputBegan:connect(function(input, gp)
  1242. if functionBank.InteractInput(input, gp) then
  1243. data.appearance.face = v.Name
  1244. rep.Events.CosmeticChange:FireServer(data.appearance)
  1245. functionBank.UpdateMimic()
  1246. end
  1247. end)
  1248. end
  1249. end
  1250. spawnGui.Customization.PlayButton.InputBegan:connect(function(input, gp)
  1251. if functionBank.InteractInput(input, gp) then
  1252. data.hasSpawned = true
  1253. cam.CameraType = Enum.CameraType.Custom
  1254. rep.Events.SpawnFirst:FireServer()
  1255. end
  1256. end)
  1257. for _, v in next, mainGui.Primary.Bag.Craft.Selection:GetChildren() do
  1258. if v:IsA("TextButton") then
  1259. v.InputBegan:connect(function(input, gp)
  1260. if functionBank.InteractInput(input, gp) then
  1261. else
  1262. return
  1263. end
  1264. functionBank.SortCraftList(v.Name)
  1265. functionBank.CreateSound(rep.Sounds.Quicks.UIToggle, player.PlayerGui)
  1266. end)
  1267. end
  1268. end
  1269. for _, v in next, mainGui.Panels.Card.List:GetChildren() do
  1270. if v:IsA("Frame") then
  1271. v.ImageButton.InputBegan:connect(function(input, gp)
  1272. if functionBank.InteractInput(input, gp) then
  1273. functionBank.OpenGui(v)
  1274. end
  1275. end)
  1276. end
  1277. end
  1278. ghost = nil
  1279. for _, v in next, mainGui.Panels.Toolbar.List:GetChildren() do
  1280. if v:IsA("ImageButton") then
  1281. v.DragBegin:connect(function(startPos)
  1282. ghost = v:Clone()
  1283. ghost.Size = UDim2.new(0, v.AbsoluteSize.X, 0, v.AbsoluteSize.Y)
  1284. ghost.AnchorPoint = Vector2.new(0.5, 0.5)
  1285. ghost.Parent = mainGui.TempEffects
  1286. while ghost and run.RenderStepped:wait() do
  1287. ghost.Position = UDim2.new(0, mouse.X, 0, mouse.Y)
  1288. end
  1289. end)
  1290. v.DragStopped:connect(function(xEnd, yEnd)
  1291. if ghost then
  1292. ghost:Destroy()
  1293. end
  1294. local overlapsWith
  1295. for _, otherButton in next, mainGui.Panels.Toolbar.List:GetChildren() do
  1296. if otherButton:IsA("ImageButton") then
  1297. local xmin, xmax, ymin, ymax = otherButton.AbsolutePosition.X, otherButton.AbsolutePosition.X + otherButton.AbsoluteSize.X, otherButton.AbsolutePosition.Y, otherButton.AbsolutePosition.Y + otherButton.AbsoluteSize.Y
  1298. if xEnd >= xmin and xEnd <= xmax and yEnd >= ymin and yEnd <= ymax then
  1299. overlapsWith = otherButton
  1300. break
  1301. end
  1302. end
  1303. end
  1304. if overlapsWith == v then
  1305. rep.Events.EquipTool:FireServer(tonumber(v.Name))
  1306. elseif overlapsWith and overlapsWith ~= v then
  1307. rep.Events.ToolSwap:FireServer(tonumber(v.Name), tonumber(overlapsWith.Name))
  1308. elseif not overlapsWith then
  1309. rep.Events.DropTool:FireServer(tonumber(v.Name))
  1310. end
  1311. end)
  1312. v.InputBegan:connect(function(input, gp)
  1313. if gp then
  1314. return
  1315. end
  1316. if input.UserInputType == Enum.UserInputType.MouseButton2 and functionBank.GetDictionaryLength(data.toolbar[tonumber(v.Name)]) > 0 then
  1317. rep.Events.Retool:FireServer(tonumber(v.Name))
  1318. end
  1319. end)
  1320. end
  1321. end
  1322. function lerp(a, b, t)
  1323. return a * (1 - t) + b * t
  1324. end
  1325. function ObjectWithinStuds(obj, studs)
  1326. if studs >= (root.Position - obj.Position).magnitude then
  1327. return true
  1328. else
  1329. return false
  1330. end
  1331. end
  1332. function ScanArray(tab, element)
  1333. for _, v in next, tab, nil do
  1334. if v == element then
  1335. return false
  1336. end
  1337. end
  1338. return true
  1339. end
  1340. function FadeTrack(sound, duration, hold)
  1341. local newTweenInfo = TweenInfo.new(duration or 5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, hold)
  1342. local newGoal = {Volume = 0}
  1343. local newTween = tweenService:Create(sound, newTweenInfo, newGoal)
  1344. newTween:Play()
  1345. end
  1346. function PartsAlongRay(ray)
  1347. local ignoreTable = {}
  1348. local part, pos
  1349. repeat
  1350. part, pos = workspace:FindPartOnRayWithIgnoreList(ray, ignoreTable)
  1351. if part ~= workspace.Terrain then
  1352. ignoreTable[#ignoreTable + 1] = part
  1353. end
  1354. until not part or part == workspace.Terrain
  1355. return ignoreTable
  1356. end
  1357. local determinePingAsync = coroutine.wrap(function()
  1358. while wait(1) do
  1359. local start = tick()
  1360. local yieldFor = rep.Events.Pinger:InvokeServer()
  1361. ping = math.clamp(tick() - start, 0, 0.3)
  1362. end
  1363. end)
  1364. determinePingAsync()
  1365. function SetupCharacter(newChar)
  1366. char = newChar
  1367. root, head, hum = newChar:WaitForChild("HumanoidRootPart"), newChar:WaitForChild("Head"), newChar:WaitForChild("Humanoid")
  1368. cam = workspace.CurrentCamera
  1369. cam.FieldOfView = 65
  1370. game.Lighting.Bloom.Intensity = 0.6
  1371. local newTweenInfo = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
  1372. local newGoal = {Intensity = 0}
  1373. local newTween = tweenService:Create(game.Lighting.Bloom, newTweenInfo, newGoal)
  1374. newTween:Play()
  1375. if not data.hasSpawned then
  1376. cam.CameraType = Enum.CameraType.Scriptable
  1377. playerGui.SpawnGui.Enabled = true
  1378. playerGui.MainGui.Enabled = false
  1379. cam.CFrame = CFrame.new(-1684.40173, -1.04321861, -2522.05884, 0.822749734, -0.0863288566, 0.561809719, 7.4505806E-9, 0.988399029, 0.151879445, -0.56840378, -0.124958768, 0.813205063)
  1380. functionBank.UpdateMimic()
  1381. return
  1382. else
  1383. cam.CameraType = Enum.CameraType.Custom
  1384. playerGui.SpawnGui.Enabled = false
  1385. playerGui.MainGui.Enabled = true
  1386. end
  1387. rep.Sounds.Music.BeautyMusic:Play()
  1388. if not data.hasSpawned then
  1389. FadeTrack(rep.Sounds.Music.BeautyMusic, 50, 30)
  1390. spawn(function()
  1391. wait(4)
  1392. functionBank.MakeToast({
  1393. title = "YOU:",
  1394. message = "...Where am I?",
  1395. color = colorData.brownUI,
  1396. image = "",
  1397. duration = 6
  1398. })
  1399. wait(6)
  1400. if not data.hasSpawned then
  1401. functionBank.MakeToast({
  1402. title = "YOU:",
  1403. message = "I should make a raft...",
  1404. color = colorData.brownUI,
  1405. image = "",
  1406. duration = 8
  1407. })
  1408. wait(4)
  1409. end
  1410. if not data.hasSpawned then
  1411. functionBank.CreateNotification("Press C to open your bag!", colorData.badRed, 4)
  1412. end
  1413. wait(14)
  1414. if not data.hasSpawned then
  1415. functionBank.CreateNotification(player.Name .. "! " .. "Press C to open your bag!", colorData.badRed, 6)
  1416. end
  1417. end)
  1418. else
  1419. FadeTrack(rep.Sounds.Music.BeautyMusic, 30, 0)
  1420. end
  1421. repeat
  1422. if not char.Parent then
  1423. wait()
  1424. end
  1425. until char.Parent == workspace
  1426. cam.CameraType = Enum.CameraType.Custom
  1427. hum.HealthChanged:connect(function()
  1428. functionBank.UpdateStats()
  1429. end)
  1430. hum.StateChanged:connect(function()
  1431. if hum:GetState() == Enum.HumanoidStateType.Seated then
  1432. char.Head:FindFirstChild("Running"):Stop()
  1433. end
  1434. end)
  1435. hum.Died:connect(function()
  1436. end)
  1437. hum:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)
  1438. hum:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics, false)
  1439. hum:SetStateEnabled(Enum.HumanoidStateType.PlatformStanding, false)
  1440. camFocus = root
  1441. moveAllowed = true
  1442. charActive = true
  1443. anims = {}
  1444. local loadAnims = coroutine.wrap(function()
  1445. for _, v in next, rep.Animations:GetChildren() do
  1446. local newAnim = v:Clone()
  1447. anims[v.Name] = hum:LoadAnimation(newAnim)
  1448. wait()
  1449. end
  1450. end)
  1451. loadAnims()
  1452. local rotationCoroutine = coroutine.wrap(function()
  1453. local bodyRotationGyro = rep.Misc.BodyRotationGyro:Clone()
  1454. bodyRotationGyro.Parent = root
  1455. bodyRotationGyro.AncestryChanged:connect(function()
  1456. if not bodyRotationGyro:IsDescendantOf(char) and bodyRotationGyro.Parent ~= nil then
  1457. print("BODYROTATION IS NOT DESCENDANT OF CHAR OR OF NIL")
  1458. player:Kick()
  1459. end
  1460. end)
  1461. while run.RenderStepped:wait() do
  1462. if cam then
  1463. local camPointOut = cam.CFrame * CFrame.new(0, 0, -1000)
  1464. if charActive and root and not uis:IsKeyDown(Enum.KeyCode.LeftControl) then
  1465. bodyRotationGyro.CFrame = CFrame.new(root.Position, camPointOut.p)
  1466. end
  1467. end
  1468. end
  1469. end)
  1470. rotationCoroutine()
  1471. end
  1472. if player.Character then
  1473. SetupCharacter(player.Character)
  1474. end
  1475. player.CharacterAdded:connect(function(newChar)
  1476. SetupCharacter(newChar)
  1477. newChar.DescendantAdded:connect(function(descendant)
  1478. if descendant:IsA("BodyMover") and (not descendant:IsA("BodyGyro") or descendant.Parent ~= newChar.PrimaryPart) then
  1479. error(player.Name, "removed")
  1480. player:Kick()
  1481. end
  1482. if descendant:IsA("Tool") or descendant:IsA("HopperBin") then
  1483. print("lmao f3x tools detected")
  1484. player:Kick()
  1485. end
  1486. end)
  1487. end)
  1488. local selectionBox = Instance.new("SelectionBox")
  1489. selectionBox.Parent = workspace
  1490. selectionBox.Color3 = Color3.fromRGB(170, 255, 0)
  1491. run.RenderStepped:connect(function()
  1492. mainGui.Panels.MouseFrame.Position = UDim2.new(0, mouse.X + 40, 0, mouse.Y + 10)
  1493. if charActive and root then
  1494. local ray = Ray.new(root.Position + Vector3.new(0, 5, 0), Vector3.new(0, -15, 0))
  1495. local part, pos, norm, mat = workspace:FindPartOnRay(ray, char)
  1496. if mat == Enum.Material.Water then
  1497. hum.WalkSpeed = currentWalkSpeed / 2.5
  1498. else
  1499. hum.WalkSpeed = currentWalkSpeed
  1500. end
  1501. end
  1502. if not data.hasSpawned then
  1503. hum.WalkSpeed = 0
  1504. hum.JumpPower = 0
  1505. end
  1506. if charActive and root and head then
  1507. if (cam.CFrame.p - head.Position).magnitude < 1.5 and data.equipped then
  1508. for _, v in next, char:GetDescendants() do
  1509. if v:IsA("BasePart") then
  1510. if v.Name ~= "GhostRightArm" and v.Parent.Name ~= data.toolbar[data.equipped].name then
  1511. v.LocalTransparencyModifier = 1
  1512. else
  1513. v.LocalTransparencyModifier = 0
  1514. end
  1515. end
  1516. end
  1517. elseif char:FindFirstChild("GhostRightArm") then
  1518. char.GhostRightArm.LocalTransparencyModifier = 1
  1519. end
  1520. end
  1521. if charActive and root then
  1522. if mouse.Target then
  1523. if mouse.Target:FindFirstChild("Draggable") or mouse.Target.Parent:FindFirstChild("Draggable") or dragObject or mouse.Target:FindFirstChild("DoorButton") then
  1524. if ObjectWithinStuds(mouse.Target, 25) then
  1525. mouse.Icon = "http://www.roblox.com/asset/?id=455570287"
  1526. else
  1527. mouse.Icon = ""
  1528. selectionBox.Adornee = nil
  1529. end
  1530. elseif mouse.Target.Parent:FindFirstChild("Interactable") then
  1531. if mouse.Target.Parent:FindFirstChild("InteractPart") then
  1532. selectionBox.Adornee = mouse.Target.Parent.InteractPart
  1533. else
  1534. selectionBox.Adornee = mouse.Target.Parent
  1535. end
  1536. mouse.Icon = "http://www.roblox.com/asset/?id=455570287"
  1537. elseif (mouse.Target:FindFirstChild("Health") or mouse.Target.Parent:FindFirstChild("Health") or mouse.Target.Parent:FindFirstChild("Humanoid")) and data.equipped and (mouse.Target.Position - root.Position).magnitude <= 25 then
  1538. mouse.Icon = "rbxassetid://117431027"
  1539. else
  1540. mouse.Icon = ""
  1541. selectionBox.Adornee = nil
  1542. end
  1543. local targName
  1544. if mouse.Target:FindFirstChild("Pickup") then
  1545. targName = mouse.Target.Name
  1546. elseif mouse.Target.Parent:FindFirstChild("Pickup") then
  1547. targName = mouse.Target.Parent.Name
  1548. end
  1549. if targName and ObjectWithinStuds(mouse.Target, 25) then
  1550. mainGui.Panels.MouseFrame.Title.Text = targName
  1551. mainGui.Panels.MouseFrame.ELabel.Text = "F - harvest"
  1552. mainGui.Panels.MouseFrame.Visible = true
  1553. if itemData[targName] and itemData[targName].nourishment then
  1554. mainGui.Panels.MouseFrame.FLabel.Text = "E - eat"
  1555. elseif mouse.Target.Material == Enum.Material.Water then
  1556. mainGui.Panels.MouseFrame.FLabel.Text = "E - drink"
  1557. else
  1558. mainGui.Panels.MouseFrame.FLabel.Text = ""
  1559. end
  1560. else
  1561. mainGui.Panels.MouseFrame.Visible = false
  1562. end
  1563. else
  1564. mouse.Icon = ""
  1565. selectionBox.Adornee = nil
  1566. end
  1567. else
  1568. mouse.Icon = ""
  1569. selectionBox.Adornee = nil
  1570. end
  1571. end)
  1572. local draggerBodyPos
  1573. function DragFunction()
  1574. if not draggerBodyPos then
  1575. draggerBodyPos = Instance.new("BodyPosition")
  1576. draggerBodyPos.Parent = dragObject
  1577. draggerBodyPos.P = 25000
  1578. draggerBodyPos.D = 1500
  1579. draggerBodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  1580. draggerBodyPos.AncestryChanged:connect(function()
  1581. if not draggerBodyPos or not draggerBodyPos.Parent then
  1582. draggerBodyPos = nil
  1583. end
  1584. end)
  1585. end
  1586. if dragObject and draggerBodyPos then
  1587. if dragObject.Parent and dragObject.Parent:IsA("Model") and dragObject.Parent ~= workspace then
  1588. mouse.TargetFilter = dragObject.Parent
  1589. else
  1590. mouse.TargetFilter = dragObject
  1591. end
  1592. if dragObject:FindFirstChild("Draggable") or dragObject.Parent and dragObject.Parent:FindFirstChild("Draggable") then
  1593. local reachRay = Ray.new(root.Position, (mouse.Hit.p - root.Position).unit * math.clamp((root.Position - mouse.Hit.p).magnitude, 3, 30))
  1594. local part, pos = workspace:FindPartOnRayWithIgnoreList(reachRay, PartsAlongRay(reachRay))
  1595. draggerBodyPos.Position = pos + Vector3.new(0, dragObject.Size.Y / 2, 0)
  1596. end
  1597. end
  1598. end
  1599. local hotkeyBank = {
  1600. pickup = Enum.KeyCode.F,
  1601. eat = Enum.KeyCode.E,
  1602. rotate = Enum.KeyCode.R,
  1603. toggleBag = Enum.KeyCode.C,
  1604. toggleTribe = Enum.KeyCode.T,
  1605. togglePatchNotes = Enum.KeyCode.X,
  1606. toggleShop = Enum.KeyCode.Z
  1607. }
  1608. uis.InputBegan:connect(function(input, gp)
Add Comment
Please, Sign In to add comment