Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loc = game.Players.LocalPlayer.PlayerScripts.LocalHandler
- Synapse:CopyString(Synapse:Decompile(loc)
- -- Synapse Decompiler
- -- Purchase Here: https://brack4712.xyz/synapse/purchase/
- local run = game:GetService("RunService")
- local rep = game:GetService("ReplicatedStorage")
- local uis = game:GetService("UserInputService")
- local starterGui = game:GetService("StarterGui")
- local debris = game:GetService("Debris")
- local tweenService = game:GetService("TweenService")
- local lighting = game:GetService("Lighting")
- local market = game:GetService("MarketplaceService")
- local spawnLocations = {}
- for _, v in next, workspace.SpawnParts:GetChildren() do
- spawnLocations[#spawnLocations + 1] = CFrame.new(v.CFrame.p)
- end
- lighting.Bloom.Intensity = 0.6
- starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
- starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)
- starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
- local setCoreDelay = coroutine.wrap(function()
- wait()
- game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)
- end)
- setCoreDelay()
- local defaultData = require(rep.Modules.DefaultData)
- local colorData = require(rep.Modules.ColorData)
- local itemData = require(rep.Modules.ItemData)
- local levelData = require(rep.Modules.LevelData)
- local cosmeticData = require(rep.Modules.CosmeticData)
- local patchNotes = require(rep.Modules.PatchNotes)
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local char, root, hum, head
- local currentWalkSpeed = 16
- local charActive = false
- local moveAllowed = false
- local cam, camFocus, camOffsetMin, camOffsetMax
- local camRot = 0
- local zoomLevel = 17
- local camOffset = Vector3.new(25, 17, -25)
- local rmbHeld = false
- local dragObject, mouseBoundStructure
- local buildingRotation = 0
- local selectionTarget
- local hasShifted = false
- local collisionDetect = Instance.new("Part")
- collisionDetect.Transparency = 1
- collisionDetect.CanCollide = false
- collisionDetect.Anchored = true
- collisionDetect.Touched:connect(function()
- end)
- local anims = {}
- ping = 0
- data = rep.Events.RequestData:InvokeServer()
- game:GetService("ContentProvider"):PreloadAsync(game.ReplicatedStorage.Animations:GetChildren())
- local playerGui = player:WaitForChild("PlayerGui")
- playerGui:SetTopbarTransparency(1)
- local mainGui = playerGui:WaitForChild("MainGui")
- local secondaryGui = playerGui:WaitForChild("SecondaryGui")
- local spawnGui = playerGui:WaitForChild("SpawnGui")
- local backpack = player:WaitForChild("Backpack")
- backpack.ChildAdded:connect(function()
- player:Kick()
- end)
- local busyTags = {}
- local noteSerializer = 1
- local maxNotifications = 3
- bodyColorList = {
- LeftUpperLeg = true,
- LeftLowerLeg = true,
- LeftFoot = true,
- RightUpperLeg = true,
- RightLowerLeg = true,
- RightFoot = true,
- UpperTorso = true,
- LowerTorso = true
- }
- skinColorList = {
- LeftUpperArm = true,
- LeftLowerArm = true,
- LeftHand = true,
- RightUpperArm = true,
- RightLowerArm = true,
- RightHand = true,
- Head = true
- }
- local chosenColor, chosenWay = nil, "yeet"
- mainGui.Primary.Tribe.NewTribe.Frame.Frame.CancelButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- functionBank.TogglePrimaryMenu("Tribe", false)
- end
- end)
- mainGui.LeftPanel.NewTribe.Frame.CreateButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) and chosenColor and chosenWay then
- rep.Events.CreateTribe:FireServer(chosenColor, chosenWay)
- rep.Sounds.Quicks.TribeSound:Play()
- functionBank.DrawTribeGui()
- end
- end)
- mainGui.LeftPanel.Tribe.LeaveButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- rep.Events.TribeLeave:FireServer()
- end
- end)
- mainGui.LeftPanel.Tribe.TotemButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- local tribeKey, tribeData = functionBank.IsInTribe()
- if tribeData and tribeData.chief == player.Name then
- if not workspace.Totems:FindFirstChild(tribeData.color .. " Tribe") then
- local totemClone = rep.Deployables["Tribe Totem"]:Clone()
- functionBank.BindMouseStructure(totemClone)
- end
- else
- functionBank.CreateNotification("Only the Chief can make a Totem!", colorData.badRed, 2)
- end
- end
- end)
- mainGui.Primary.Tribe.TribeConsole.Members.InviteButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.Visible = not mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.Visible
- if mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.Visible then
- for _, v in next, mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.List:GetChildren() do
- if v:IsA("TextButton") then
- v:Destroy()
- end
- end
- for _, otherPlayer in next, game.Players:GetPlayers() do
- do
- local playerButton = mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.Templates.TextButton:Clone()
- playerButton.Text = otherPlayer.Name
- playerButton.Visible = true
- playerButton.Parent = mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.List
- playerButton.Name = otherPlayer.Name
- playerButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- rep.Events.TribeInvite:FireServer(otherPlayer)
- for _, v in next, mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.List:GetChildren() do
- if v:IsA("TextButton") then
- v:Destroy()
- end
- end
- mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.Visible = false
- end
- end)
- end
- end
- else
- for _, v in next, mainGui.Primary.Tribe.TribeConsole.Members.InviteFrame.List:GetChildren() do
- if v:IsA("TextButton") then
- v:Destroy()
- end
- end
- end
- end
- end)
- for _, v in next, mainGui.RightPanel.Inventory.ArmorFrame.Frame:GetChildren() do
- if v:IsA("ImageButton") then
- v.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) and data.armor[v.Name] and data.armor[v.Name] ~= "none" then
- rep.Events.UnequipArmor:FireServer(data.armor[v.Name])
- end
- end)
- end
- end
- secondaryGui.PlayerList.List.ActionPanel.KickButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- local targetPlayerName = secondaryGui.PlayerList.List.ActionPanel.TargetPlayerName.Value
- if targetPlayerName then
- local targetPlayer = game.Players:FindFirstChild(targetPlayerName)
- if targetPlayer then
- rep.Events.TribeKick:FireServer(targetPlayer)
- secondaryGui.PlayerList.List.ActionPanel.Visible = false
- end
- end
- end
- end)
- secondaryGui.PlayerList.List.ActionPanel.CancelButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- secondaryGui.PlayerList.List.ActionPanel.Visible = false
- end
- end)
- secondaryGui.PlayerList.List.ActionPanel.InviteButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- rep.Events.TribeInvite:FireServer(game.Players:FindFirstChild(secondaryGui.PlayerList.List.ActionPanel.TargetPlayerName.Value))
- secondaryGui.PlayerList.List.ActionPanel.Visible = false
- end
- end)
- for _, button in next, mainGui.LeftPanel.Craft.Selection:GetChildren() do
- if button:IsA("ImageButton") then
- button.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- button.BackgroundColor3 = colorData.goodGreen
- for _, v in next, mainGui.LeftPanel.Craft.Selection:GetChildren() do
- if v:IsA("ImageButton") and v ~= button then
- v.BackgroundColor3 = colorData.grey200
- end
- end
- functionBank.DrawCraftMenu(button.Category.Value)
- end
- end)
- end
- end
- mainGui.LeftPanel.Craft.SearchBar.Changed:connect(function(property)
- if property == "Text" then
- if mainGui.LeftPanel.Craft.SearchBar.Text == "" then
- functionBank.DrawCraftMenu("all")
- else
- for _, v in next, mainGui.LeftPanel.Craft.Selection:GetChildren() do
- if v:IsA("ImageButton") then
- v.BackgroundColor3 = colorData.grey200
- end
- end
- functionBank.DrawCraftMenu("all", mainGui.LeftPanel.Craft.SearchBar.Text)
- end
- end
- end)
- mainGui.RightPanel.Inventory.RedoAvatarButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- rep.Events.RedoAvatar:FireServer()
- end
- end)
- for _, chestFrame in next, mainGui.LeftPanel.Shop.Lists.ChestList:GetChildren() do
- if chestFrame:IsA("Frame") then
- chestFrame.OpenButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- if chestFrame.OpenButton.Text ~= "OPEN" then
- market:PromptProductPurchase(player, chestFrame.OpenButton.ProductId.Value)
- else
- rep.Events.ChestDrop:FireServer(chestFrame.Name)
- end
- end
- end)
- end
- end
- local rayIgnore = {}
- local lastToast, toastWait = 0, 0
- local currentToast = 1
- local lastCraftCategory, lastCraftSearch = "all", nil
- functionBank = {
- NearestTotemAndDistance = function(pos)
- local ignoreTotemColor
- local tribeKey, tribeData = functionBank.IsInTribe()
- if tribeData then
- ignoreTotemColor = tribeData.color
- end
- local closestTotem, closestDistance = nil, math.huge
- for _, totem in next, workspace.Totems:GetChildren() do
- if totem.TribeColor.Value ~= ignoreTotemColor then
- local distance = (totem.PrimaryPart.Position - pos).magnitude
- if closestDistance > distance then
- closestTotem, closestDistance = totem, distance
- end
- end
- end
- return closestTotem, closestDistance
- end,
- BindMouseStructure = function(item)
- mouseBoundStructure = item
- for _, v in next, mouseBoundStructure:GetDescendants() do
- if v:IsA("BasePart") then
- if v.Name == "Reference" or v.Name == "Interactable" or v.Name == "Effect" then
- v.Transparency = 1
- else
- v.Transparency = 0.3
- end
- v.Material = Enum.Material.Glass
- v.CanCollide = false
- v.Anchored = true
- elseif v:IsA("Weld") or v:IsA("ManualWeld") then
- else
- v:Destroy()
- end
- end
- local function swapBoundColor(toggle)
- if toggle then
- if mouseBoundStructure.PrimaryPart.Color == colorData.goodGreen then
- return
- end
- for _, v in next, mouseBoundStructure:GetDescendants() do
- if v:IsA("BasePart") then
- v.Color = colorData.goodGreen
- end
- end
- else
- if mouseBoundStructure.PrimaryPart.BrickColor == colorData.badRed then
- return
- end
- for _, v in next, mouseBoundStructure:GetDescendants() do
- if v:IsA("BasePart") then
- v.Color = colorData.badRed
- end
- end
- end
- end
- mouseBoundStructure.Parent = char
- while mouseBoundStructure do
- mouse.TargetFilter = mouseBoundStructure
- local part, pos, norm, mat = functionBank.RayUntil(mouse.Hit.p + Vector3.new(0, 10, 0), Vector3.new(0, -1000, 0))
- mouseBoundStructure:SetPrimaryPartCFrame(CFrame.new(pos) * CFrame.Angles(0, math.rad(buildingRotation), 0))
- local canPlace = true
- if (pos - root.Position).magnitude > 50 then
- canPlace = false
- end
- if part ~= workspace.Terrain and itemData[mouseBoundStructure.Name].placement ~= "all" then
- canPlace = false
- end
- if mat and mat == Enum.Material.Water and itemData[mouseBoundStructure.Name].placement ~= "sea" then
- canPlace = false
- end
- if mat and mat ~= Enum.Material.Water and itemData[mouseBoundStructure.Name].placement == "sea" then
- canPlace = false
- end
- if itemData[mouseBoundStructure.Name].recipe and not functionBank.CanCraftItem(mouseBoundStructure.Name) then
- canPlace = false
- end
- for _, v in next, spawnLocations, nil do
- if itemData[mouseBoundStructure.Name].placement ~= "sea" and (pos - v.p).magnitude < 25 then
- canPlace = false
- end
- end
- local closestTotem, distance = functionBank.NearestTotemAndDistance(pos)
- if distance < 175 then
- canPlace = false
- end
- swapBoundColor(canPlace)
- run.RenderStepped:wait()
- end
- end,
- DrawPatchNotes = function()
- for _, v in next, mainGui.LeftPanel.PatchNotes.List:GetChildren() do
- if v:IsA("TextLabel") then
- v:Destroy()
- end
- end
- local serial = 1
- for _, noteData in next, patchNotes, nil do
- local newHeader = mainGui.LeftPanel.PatchNotes.Templates.Header:Clone()
- newHeader.Text = noteData.title
- newHeader.LayoutOrder = serial
- serial = serial + 1
- newHeader.Parent = mainGui.LeftPanel.PatchNotes.List
- newHeader.Visible = true
- local newTitle = mainGui.LeftPanel.PatchNotes.Templates.Title:Clone()
- newTitle.Text = noteData.date
- newTitle.LayoutOrder = serial
- serial = serial + 1
- newTitle.Parent = mainGui.LeftPanel.PatchNotes.List
- newTitle.Visible = true
- for _, update in next, noteData.updates, nil do
- if update.textType == "title" then
- local newTitle = mainGui.LeftPanel.PatchNotes.Templates.Title:Clone()
- newTitle.Text = update.message
- newTitle.LayoutOrder = serial
- serial = serial + 1
- newTitle.Parent = mainGui.LeftPanel.PatchNotes.List
- newTitle.Visible = true
- else
- local newNote = mainGui.LeftPanel.PatchNotes.Templates.Note:Clone()
- newNote.Text = update.message
- newNote.LayoutOrder = serial
- serial = serial + 1
- newNote.Parent = mainGui.LeftPanel.PatchNotes.List
- newNote.Visible = true
- end
- end
- end
- spawn(function()
- mainGui.LeftPanel.PatchNotes.List.CanvasSize = UDim2.new(1, 0, 0, mainGui.LeftPanel.PatchNotes.List.UIListLayout.AbsoluteContentSize.Y)
- end)
- end,
- IsInTribe = function()
- local is = false
- print("local IsInATribe, tribes table is", tribes)
- for tribeKey, tribeData in next, tribes, nil do
- if tribeData.chief == player.Name then
- return tribeKey, tribeData
- end
- for _, member in next, tribeData.members, nil do
- if member == player.Name then
- return tribeKey, tribeData
- end
- end
- end
- return nil
- end,
- UpdatePlayerList = function(playerListData, tribesList)
- print("UpdatePlayerList received", playerListData, tribesList)
- for _, v in next, secondaryGui.PlayerList.List:GetChildren() do
- if v:IsA("Frame") and v.Name ~= "ActionPanel" then
- v:Destroy()
- end
- end
- for key, v in next, playerListData, nil do
- do
- local nameTag = secondaryGui.PlayerList.Templates.Frame:Clone()
- nameTag.Name = v.playerName
- nameTag.TextLabel.Text = v.playerName
- nameTag.ImageLabel.BackgroundColor3 = v.playerColor
- local tribeName
- for key, col in next, colorData.TribeColors, nil do
- if col == v.playerColor then
- tribeName = key
- end
- end
- nameTag.ImageLabel.TextLabel.Text = v.playerLevel
- nameTag.ImageLabel.Visible = true
- nameTag.Name = v.playerName
- nameTag.LayoutOrder = (colorData.TribeOffsets[tribeName] or 0) + string.byte(string.sub(v.playerName, 1, 1))
- nameTag.Parent = secondaryGui.PlayerList.List
- nameTag.Visible = true
- nameTag.ImageButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- local menuType = "none"
- local tribeInfo
- for tribeKey, tribeData in next, tribesList, nil do
- local member
- for _, v in next, tribeData.members, nil do
- if v == player.Name then
- member = true
- end
- end
- if member then
- menuType = "member"
- tribeInfo = tribeData
- break
- elseif tribeData.chief == player.Name then
- menuType = "chief"
- tribeInfo = tribeData
- break
- else
- menuType = "none"
- end
- end
- secondaryGui.PlayerList.List.ActionPanel.KickButton.Visible = false
- secondaryGui.PlayerList.List.ActionPanel.InviteButton.Visible = false
- if menuType == "chief" then
- secondaryGui.PlayerList.List.ActionPanel.KickButton.Visible = true
- end
- if menuType == "chief" or menuType == "member" then
- secondaryGui.PlayerList.List.ActionPanel.InviteButton.Visible = true
- end
- secondaryGui.PlayerList.List.ActionPanel.Visible = true
- secondaryGui.PlayerList.List.ActionPanel.TargetPlayerName.Value = nameTag.Name
- secondaryGui.PlayerList.List.ActionPanel.LayoutOrder = nameTag.LayoutOrder + 1
- end
- end)
- 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
- secondaryGui.PlayerList.List.ActionPanel.LayoutOrder = secondaryGui.PlayerList.List:FindFirstChild(secondaryGui.PlayerList.List.ActionPanel.TargetPlayerName.Value).LayoutOrder + 1
- end
- end
- end
- end,
- UpdateArmor = function()
- for locus, armorName in next, data.armor, nil do
- if armorName and armorName ~= "none" then
- mainGui.RightPanel.Inventory.ArmorFrame.Frame[locus].Image = itemData[armorName].image
- mainGui.RightPanel.Inventory.ArmorFrame.Frame[locus].DefaultIcon.ImageTransparency = 1
- else
- mainGui.RightPanel.Inventory.ArmorFrame.Frame[locus].Image = ""
- mainGui.RightPanel.Inventory.ArmorFrame.Frame[locus].DefaultIcon.ImageTransparency = 0
- end
- end
- end,
- UpdateMimic = function()
- for limbName, val in next, skinColorList, nil do
- char:FindFirstChild(limbName).Color = cosmeticData.skinColors[data.appearance.skin]
- end
- char.Head.Face.Texture = cosmeticData.faceIds[data.appearance.face]
- for _, v in next, char:GetChildren() do
- if v.Name == "Hair" then
- v:Destroy()
- end
- end
- if data.appearance.hair ~= "Bald" then
- local newHair = rep.Cosmetics.Hair:FindFirstChild(data.appearance.hair):Clone()
- local weld = Instance.new("Weld")
- weld.Parent = newHair
- newHair.CFrame = char.Head.CFrame
- weld.Part0 = newHair
- weld.Part1 = char.Head
- weld.C0 = CFrame.new(0, 0, 0)
- newHair.Name = "Hair"
- newHair.Parent = char
- end
- end,
- MakeToast = function(toastData)
- local title, message, color, image, duration = toastData.title, toastData.message, toastData.color, toastData.image, toastData.duration
- if tick() - lastToast < toastWait then
- repeat
- wait(math.random() / 30)
- until tick() - lastToast >= toastWait
- end
- lastToast = tick()
- toastWait = duration + 2
- currentToast = currentToast + 1
- local toastId = currentToast
- local toastFrame = mainGui.Panels.Toasts
- toastFrame.Message.Text = ""
- toastFrame.Title.Text = title
- toastFrame.ImageLabel.Image = image
- toastFrame.ImageLabel.BackgroundColor3 = color
- toastFrame.Message.TextColor3 = color
- toastFrame:TweenPosition(UDim2.new(1, 0, 0.75, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 1, true)
- wait(1)
- for i = 1, #message do
- toastFrame.Message.Text = string.sub(message, 1, i)
- rep.Sounds.Quicks.Text:Play()
- wait(0.04)
- end
- wait(duration)
- if currentToast == toastId then
- toastFrame:TweenPosition(UDim2.new(1.5, 0, 0.75, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 1, true)
- end
- end,
- RayUntil = function(origin, destination)
- local ray = Ray.new(origin, destination)
- local part, pos, norm, mat = workspace:FindPartOnRayWithIgnoreList(ray, rayIgnore)
- if part and part ~= workspace.Terrain then
- table.insert(rayIgnore, part)
- return functionBank.RayUntil(origin, destination)
- end
- rayIgnore = {}
- return part, pos, norm, mat
- end,
- CreateParticles = function(instance, origin, facing, count, duration, particleProperties)
- local part = Instance.new("Part")
- part.Anchored = true
- part.CanCollide = false
- part.Transparency = 1
- part.Size = Vector3.new(0, 0, 0)
- part.CFrame = CFrame.new(origin, facing)
- local emitter = instance:Clone()
- emitter.Parent = part
- emitter.EmissionDirection = Enum.NormalId.Front
- if particleProperties then
- for property, val in next, particleProperties, nil do
- emitter[property] = val
- end
- end
- part.Parent = workspace
- wait()
- if count then
- emitter.Rate = 0
- emitter:Emit(count)
- debris:AddItem(part, duration)
- else
- debris:AddItem(part, duration)
- end
- end,
- CollectPart = function(obj)
- local duration = 0.2
- if obj:IsA("BasePart") then
- local newObj = obj:Clone()
- newObj:ClearAllChildren()
- newObj.CanCollide = false
- newObj.Anchored = true
- obj:Destroy()
- newObj.Parent = cam
- local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0)
- local goals = {
- CFrame = root.CFrame,
- Size = Vector3.new(0.6, 0.6, 0.6),
- Transparency = 1
- }
- local tween = tweenService:Create(newObj, tweenInfo, goals)
- tween:Play()
- debris:AddItem(newObj, duration)
- else
- obj:Destroy()
- end
- end,
- CleanNils = function(tab)
- local newTab = {}
- for _, v in next, tab, nil do
- newTab[#newTab + 1] = v
- end
- return newTab
- end,
- AppendTables = function(tables)
- local mainTable = {}
- for tabKey, tabData in next, tables, nil do
- for key, val in next, tabData, nil do
- mainTable[#mainTable + 1] = val
- end
- end
- return mainTable
- end,
- DrawTribeGui = function()
- tribes = rep.Events.RequestTribeData:InvokeServer()
- local tribeKey, tribeData = functionBank.IsInTribe()
- if tribeKey then
- mainGui.LeftPanel.Tribe.Chief.ImageLabel.BackgroundColor3 = colorData.TribeColors[tribeData.color]
- mainGui.LeftPanel.Tribe.Chief.Message.TextColor3 = colorData.TribeColors[tribeData.color]
- if tribeData.message ~= "" then
- mainGui.LeftPanel.Tribe.Chief.Message.Text = "\"" .. tribeData.message .. "\""
- else
- mainGui.LeftPanel.Tribe.Chief.Message.Text = ""
- end
- mainGui.LeftPanel.Tribe.Members.MembersTitle.Text = "MEMBERS"
- mainGui.LeftPanel.Tribe.Members.MembersTitle.BackgroundColor3 = colorData.TribeColors[tribeData.color]
- mainGui.LeftPanel.Tribe.Title.Text = string.upper(tribeData.color) .. " TRIBE"
- mainGui.LeftPanel.Tribe.Title.TextColor3 = colorData.TribeColors[tribeData.color]
- for _, v in next, mainGui.LeftPanel.Tribe.Members.Frame.List:GetChildren() do
- if v:IsA("TextButton") then
- v:Destroy()
- end
- end
- local chiefButton = mainGui.LeftPanel.Tribe.Members.Frame.Templates.TextButton:Clone()
- chiefButton.BackgroundColor3 = colorData.TribeColors[tribeData.color]
- chiefButton.Text = "Chief " .. tribeData.chief
- chiefButton.Parent = mainGui.LeftPanel.Tribe.Members.Frame.List
- chiefButton.Visible = true
- for _, v in next, tribeData.members, nil do
- local memberButton = mainGui.LeftPanel.Tribe.Members.Frame.Templates.TextButton:Clone()
- memberButton.Text = v
- memberButton.Parent = mainGui.LeftPanel.Tribe.Members.Frame.List
- memberButton.Visible = true
- end
- end
- end,
- CreateSound = function(sound, parent, waver)
- sound = sound:Clone()
- sound.Parent = parent
- if waver then
- sound.Pitch = sound.Pitch + (sound.DefaultPitch.Value or 1) * (math.random(-25, 25) / 100)
- end
- repeat
- if not (sound.TimeLength > 0) then
- wait()
- else
- end
- until sound.TimeLength > 0
- sound:Play()
- wait()
- debris:AddItem(sound, sound.TimeLength)
- end,
- CreateNotification = function(text, color, duration)
- duration = duration or 1
- local fadeLength = 2
- local totalNotes = #mainGui.Subordinates.Notifications:GetChildren() - 2
- if totalNotes >= maxNotifications then
- local lowestNote, noteLevel = nil, math.huge
- for _, v in next, mainGui.Subordinates.Notifications:GetChildren() do
- if v:IsA("TextLabel") and noteLevel > v.LayoutOrder then
- lowestNote, noteLevel = v, v.LayoutOrder
- end
- end
- if lowestNote then
- lowestNote:Destroy()
- end
- end
- local notification = mainGui.Subordinates.Notifications.Templates.TextLabel:Clone()
- notification.Text = text
- notification.TextColor3 = color or Color3.fromRGB(255, 255, 255)
- notification.LayoutOrder = noteSerializer
- noteSerializer = noteSerializer + 1
- notification.Parent = mainGui.Subordinates.Notifications
- notification.Visible = true
- debris:AddItem(notification, duration + fadeLength)
- local tweenInfo = TweenInfo.new(fadeLength, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, duration or 1)
- local goals = {
- BackgroundTransparency = 1,
- TextTransparency = 1,
- TextStrokeTransparency = 1
- }
- local tween = tweenService:Create(notification, tweenInfo, goals)
- tween:Play()
- end,
- UpdateBillboards = function(clear)
- if selectionTarget then
- do
- local gui = playerGui:FindFirstChild(selectionTarget.Name)
- if gui then
- if clear then
- gui:Destroy()
- selectionTarget = nil
- return
- end
- for _, v in next, gui.Frame.List:GetChildren() do
- if v:IsA("ImageButton") then
- v:Destroy()
- end
- end
- if gui.Name == "Campfire" then
- for _, v in next, data.inventory, nil do
- if itemData[v.name].fuels then
- do
- local button = gui.Frame.Templates.ImageButton:Clone()
- button.Image = itemData[v.name].image
- button.TextLabel.Text = v.quantity
- button.Name = v.name
- button.Parent = gui.Frame.List
- button.Visible = true
- button.MouseButton1Down:connect(function()
- rep.Events.InteractStructure:FireServer(selectionTarget, button.Name)
- rep.Sounds.Quicks.Click3:Play()
- selectionTarget.Board.Billboard.Backdrop.TextLabel.Text = math.floor(tonumber(selectionTarget.Board.Billboard.Backdrop.TextLabel.Text) + 0.5)
- selectionTarget.Board.Billboard.Backdrop.Slider.Size = UDim2.new(tonumber(selectionTarget.Board.Billboard.Backdrop.TextLabel.Text) / itemData[selectionTarget.Name].capacity, 0, 1, 0)
- selectionTarget.Board.Billboard.Backdrop.Slider.BackgroundColor3 = Color3.fromRGB(255, 0, 0):lerp(Color3.fromRGB(170, 255, 0), selectionTarget.Board.Billboard.Backdrop.TextLabel.Text / 100)
- if tonumber(selectionTarget.Board.Billboard.Backdrop.TextLabel.Text) >= itemData[selectionTarget.Name].capacity * 0.95 then
- gui:Destroy()
- selectionTarget = nil
- return
- end
- end)
- end
- end
- end
- elseif gui.Name == "Plant Box" then
- for _, v in next, data.inventory, nil do
- if itemData[v.name] and itemData[v.name].grows then
- do
- local button = gui.Frame.Templates.ImageButton:Clone()
- button.Image = itemData[v.name].image
- button.TextLabel.Text = v.quantity
- button.Name = v.name
- button.Parent = gui.Frame.List
- button.Visible = true
- button.MouseButton1Down:connect(function()
- rep.Events.InteractStructure:FireServer(selectionTarget, button.Name)
- rep.Sounds.Quicks.Click3:Play()
- end)
- end
- end
- end
- elseif gui.Name == "Grinder" then
- for _, v in next, data.inventory, nil do
- if itemData[v.name].grindsTo then
- do
- local button = gui.Frame.Templates.ImageButton:Clone()
- button.Image = itemData[v.name].image
- button.TextLabel.Text = v.quantity
- button.Name = v.name
- button.Parent = gui.Frame.List
- button.Visible = true
- button.MouseButton1Down:connect(function()
- rep.Events.InteractStructure:FireServer(selectionTarget, button.Name)
- rep.Sounds.Quicks.Click3:Play()
- end)
- end
- end
- end
- end
- else
- return
- end
- end
- end
- end,
- UpdateStats = function()
- mainGui.Panels.Stats.List.Food.Slider.Size = UDim2.new(data.stats.food / 100, 0, 1, 0)
- if hum then
- mainGui.Panels.Stats.List.Health.Slider.Size = UDim2.new(math.clamp(hum.Health / hum.MaxHealth, 0, 1), 0, 1, 0)
- end
- local playerLoad, maxLoad = functionBank.CalculateLoad()
- mainGui.Panels.Stats.List.Bag.Slider.Size = UDim2.new(math.clamp(playerLoad / maxLoad, 0, 1), 0, 1, 0)
- mainGui.Panels.Topbar.EssenceFrame.Frame.TextLabel.Text = "lvl " .. data.level
- local nextLevelCost = levelData[data.level] or math.huge
- mainGui.Panels.Topbar.EssenceFrame.Frame.Bar.Slider.Size = UDim2.new(data.essence / nextLevelCost, 0, 1, 0)
- if player.Character and player.Character:FindFirstChild("HumanoidRootPart") and not player.Character.PrimaryPart.CanCollide then
- player:Kick()
- end
- end,
- HasItem = function(itemName)
- for key, v in next, data.inventory, nil do
- if v.name == itemName then
- return key
- end
- end
- return false
- end,
- CanCraftItem = function(itemName)
- local itemInfo = itemData[itemName]
- local canCraft = true
- for ingredientName, ingredientQuantity in next, itemInfo.recipe, nil do
- local hasKey = functionBank.HasItem(ingredientName)
- if hasKey then
- if ingredientQuantity > data.inventory[hasKey].quantity then
- canCraft = false
- end
- else
- canCraft = false
- end
- end
- return canCraft
- end,
- CalculateLoad = function()
- local playerLoad = 0
- local maxLoad
- if data.armor.bag and data.armor.bag ~= "none" then
- maxLoad = itemData[data.armor.bag].maxLoad
- else
- maxLoad = 100
- end
- for _, v in next, data.inventory, nil do
- if v.quantity and itemData[v.name] then
- playerLoad = playerLoad + v.quantity * (itemData[v.name].load or 0)
- end
- end
- return playerLoad, maxLoad
- end,
- CanBearLoad = function(itemName)
- local anticipatedLoad = itemData[itemName].load or 0
- local playerLoad, maxLoad = functionBank.CalculateLoad()
- if maxLoad >= playerLoad + anticipatedLoad then
- return true
- else
- return false
- end
- end,
- OpenGui = function(card)
- if not card then
- secondaryGui.PlayerList.Visible = true
- local toClose = functionBank.AppendTables({
- mainGui.RightPanel:GetChildren(),
- mainGui.LeftPanel:GetChildren()
- })
- for _, v in next, toClose, nil do
- if v:IsA("Frame") then
- v.Visible = false
- end
- end
- for _, v in next, mainGui.Panels.Card.List:GetChildren() do
- if v:IsA("Frame") then
- v.ImageButton.BackgroundColor3 = colorData.ironGrey
- v.Status.Value = false
- end
- end
- return
- end
- if card.Status.Value then
- secondaryGui.PlayerList.Visible = true
- local toClose = functionBank.AppendTables({
- mainGui.RightPanel:GetChildren(),
- mainGui.LeftPanel:GetChildren()
- })
- for _, v in next, toClose, nil do
- if v:IsA("Frame") then
- v.Visible = false
- end
- end
- for _, v in next, mainGui.Panels.Card.List:GetChildren() do
- if v:IsA("Frame") then
- v.ImageButton.BackgroundColor3 = colorData.ironGrey
- v.Status.Value = false
- end
- end
- else
- local toClose = functionBank.AppendTables({
- mainGui.RightPanel:GetChildren(),
- mainGui.LeftPanel:GetChildren()
- })
- for _, v in next, toClose, nil do
- if v:IsA("Frame") then
- v.Visible = false
- end
- end
- for _, v in next, mainGui.Panels.Card.List:GetChildren() do
- if v:IsA("Frame") then
- v.ImageButton.BackgroundColor3 = colorData.ironGrey
- v.Status.Value = false
- end
- end
- secondaryGui.PlayerList.Visible = true
- for _, pointer in next, card.Opens:GetChildren() do
- pointer.Value.Visible = true
- if pointer.Value:IsDescendantOf(mainGui.RightPanel) then
- secondaryGui.PlayerList.Visible = false
- end
- if pointer.Value == mainGui.LeftPanel.Tribe then
- local tribeKey, tribeData = functionBank.IsInTribe()
- if not tribeKey then
- print("not in a tribe ree")
- pointer.Value.Visible = false
- mainGui.LeftPanel.NewTribe.Visible = true
- for _, v in next, mainGui.LeftPanel.NewTribe.Frame.Frame.ColorList:GetChildren() do
- if v:IsA("ImageButton") then
- v:Destroy()
- end
- end
- for colorName, colorRGB in next, colorData.TribeColors, nil do
- do
- local colorButton = mainGui.LeftPanel.NewTribe.Frame.Frame.Templates.ImageButton:Clone()
- for _, tribeData in next, tribes, nil do
- if tribeData.color == colorName then
- local possibleChief = game.Players:FindFirstChild(tribeData.chief or "")
- if possibleChief then
- colorButton.Image = "https://web.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userid=" .. possibleChief.UserId
- end
- end
- end
- colorButton.BackgroundColor3 = colorRGB
- colorButton.Visible = true
- colorButton.Parent = mainGui.LeftPanel.NewTribe.Frame.Frame.ColorList
- colorButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- chosenColor = colorName
- mainGui.LeftPanel.NewTribe.Frame.ColorTitle.BackgroundColor3 = colorRGB
- mainGui.LeftPanel.NewTribe.Frame.ColorTitle.TextColor3 = colorRGB
- mainGui.LeftPanel.NewTribe.Frame.ColorTitle.Text = string.upper(colorName)
- for _, v in next, mainGui.LeftPanel.NewTribe.Frame.Frame.ColorList:GetChildren() do
- if v:IsA("ImageButton") then
- if v.BackgroundColor3 ~= colorRGB then
- v.BorderSizePixel = 0
- else
- v.BorderSizePixel = 5
- end
- end
- end
- end
- end)
- end
- end
- end
- end
- end
- card.ImageButton.BackgroundColor3 = colorData.goodGreen
- card.Status.Value = true
- end
- end,
- PreQuantity = function(itemName)
- local preQuantity = 0
- for _, v in next, data.inventory, nil do
- if v.name == itemName and v.quantity then
- preQuantity = v.quantity
- return preQuantity
- end
- end
- return 0
- end,
- InteractInput = function(input, gp)
- if gp then
- return
- end
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch or input.KeyCode == Enum.KeyCode.ButtonA then
- return true
- else
- return false
- end
- end,
- UpdateCraftMenu = function()
- for _, newFrame in next, mainGui.LeftPanel.Craft.List:GetChildren() do
- if newFrame:IsA("Frame") and newFrame.Name ~= "LockedFrame" then
- local itemName, itemInfo = newFrame.Name, itemData[newFrame.Name]
- local canCraft = true
- for _, ingredientFrame in next, newFrame.IngredientsList:GetChildren() do
- if ingredientFrame:IsA("Frame") then
- local ingredientName, ingredientQuantity = ingredientFrame.Name, itemInfo.recipe[ingredientFrame.Name]
- local hasKey = functionBank.HasItem(ingredientName)
- if hasKey then
- if ingredientQuantity > data.inventory[hasKey].quantity then
- canCraft = false
- ingredientFrame.IngredientName.BackgroundColor3 = colorData.badRed
- else
- ingredientFrame.IngredientName.BackgroundColor3 = colorData.goodGreen
- end
- else
- canCraft = false
- ingredientFrame.IngredientName.BackgroundColor3 = colorData.badRed
- end
- end
- end
- if canCraft then
- newFrame.CraftButton.BackgroundColor3 = colorData.goodGreen
- newFrame.CraftButton.Text = ">"
- else
- newFrame.CraftButton.BackgroundColor3 = colorData.badRed
- newFrame.CraftButton.Text = "X"
- end
- end
- end
- end,
- DrawCraftMenu = function(category, phrase)
- for _, v in next, mainGui.LeftPanel.Craft.List:GetChildren() do
- if v:IsA("Frame") then
- v:Destroy()
- end
- end
- for itemName, itemInfo in next, itemData, nil do
- do
- local relevant = true
- if not itemInfo.recipe then
- relevant = false
- end
- if category and category ~= "all" and itemInfo.itemType ~= category then
- relevant = false
- end
- if phrase and not itemName:lower():match(phrase:lower()) then
- relevant = false
- end
- if relevant then
- if itemInfo.craftLevel <= data.level then
- local newFrame = mainGui.LeftPanel.Craft.Templates.ItemFrame:Clone()
- newFrame.ImageLabel.Image = itemInfo.image
- newFrame.Title.Text = itemName
- newFrame.Name = itemName
- local canCraft = true
- for ingredientName, ingredientQuantity in next, itemInfo.recipe, nil do
- local ingredientFrame = mainGui.LeftPanel.Craft.Templates.Ingredient:Clone()
- ingredientFrame.ImageLabel.Image = itemData[ingredientName].image
- ingredientFrame.IngredientName.Text = ingredientQuantity .. " " .. ingredientName
- ingredientFrame.Name = ingredientName
- local hasKey = functionBank.HasItem(ingredientName)
- if hasKey then
- if data.inventory[hasKey].quantity then
- if ingredientQuantity <= data.inventory[hasKey].quantity then
- ingredientFrame.IngredientName.BackgroundColor3 = colorData.goodGreen
- else
- ingredientFrame.IngredientName.BackgroundColor3 = colorData.badRed
- canCraft = false
- end
- else
- end
- else
- canCraft = false
- end
- ingredientFrame.Parent = newFrame.IngredientsList
- ingredientFrame.Visible = true
- end
- if canCraft then
- newFrame.CraftButton.Text = ">"
- newFrame.CraftButton.BackgroundColor3 = colorData.goodGreen
- else
- newFrame.CraftButton.Text = "X"
- newFrame.CraftButton.BackgroundColor3 = colorData.badRed
- end
- newFrame.CraftButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) and functionBank.CanCraftItem(itemName) then
- if itemInfo.deployable then
- functionBank.OpenGui()
- if dragObject then
- dragObject = nil
- end
- functionBank.BindMouseStructure(rep.Deployables:FindFirstChild(itemName):Clone())
- else
- rep.Events.CraftItem:FireServer(itemName)
- end
- end
- end)
- newFrame.LayoutOrder = itemInfo.craftLevel
- newFrame.Parent = mainGui.LeftPanel.Craft.List
- newFrame.Visible = true
- else
- local lockedFrame = mainGui.LeftPanel.Craft.Templates.LockedFrame:Clone()
- lockedFrame.LockedLabel.Text = "LOCKED [" .. itemInfo.craftLevel .. "]"
- lockedFrame.Title.Text = itemName
- lockedFrame.LayoutOrder = 100 + itemInfo.craftLevel
- lockedFrame.Parent = mainGui.LeftPanel.Craft.List
- lockedFrame.Visible = true
- end
- else
- end
- end
- end
- local foundFrame = mainGui.LeftPanel.Craft.List:FindFirstChildOfClass("Frame")
- local offset
- if foundFrame then
- offset = foundFrame.AbsoluteSize.Y + 15
- else
- offset = 15
- end
- mainGui.LeftPanel.Craft.List.CanvasSize = UDim2.new(1, 0, 0, #mainGui.LeftPanel.Craft.List:GetChildren() * offset)
- end,
- DrawInventory = function()
- for _, chestFrame in next, mainGui.LeftPanel.Shop.Lists.ChestList:GetChildren() do
- if chestFrame:IsA("Frame") then
- local count = 0
- local hasKey = functionBank.HasItem(chestFrame.Name)
- if hasKey then
- count = data.inventory[hasKey].quantity
- end
- chestFrame.Quantity.Text = count
- if count > 0 then
- chestFrame.OpenButton.Text = "OPEN"
- chestFrame.OpenButton.BackgroundColor3 = colorData.goodGreen
- chestFrame.Quantity.TextColor3 = colorData.goodGreen
- else
- chestFrame.OpenButton.Text = "BUY"
- chestFrame.OpenButton.BackgroundColor3 = colorData.essenceYellow
- chestFrame.Quantity.TextColor3 = Color3.fromRGB(255, 255, 255)
- end
- end
- end
- for _, categoryFrame in next, mainGui.RightPanel.Inventory.List:GetChildren() do
- if categoryFrame:IsA("Frame") then
- for _, v in next, categoryFrame:GetChildren() do
- if v:IsA("Frame") then
- v:Destroy()
- end
- end
- end
- end
- for itemKey, itemInfo in next, data.inventory, nil do
- if itemInfo.itemType ~= "chestDrop" then
- do
- local newFrame = mainGui.RightPanel.Inventory.Templates.ItemFrame:Clone()
- if not itemData[itemInfo.name] then
- print(itemInfo.name, "has no image")
- end
- newFrame.ImageButton.Image = itemData[itemInfo.name].image
- newFrame.Name = itemInfo.name
- newFrame.ImageButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- rep.Events.UseBagItem:FireServer(itemInfo.name)
- if itemData[itemInfo.name].nourishment then
- functionBank.CreateSound(rep.Sounds.Quicks.Eat, player.PlayerGui, true)
- end
- elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
- rep.Events.DropBagItem:FireServer(itemInfo.name)
- end
- end)
- newFrame.ItemNameLabel.Text = itemInfo.name
- newFrame.ItemNameLabel.Visible = false
- newFrame.ImageButton.MouseEnter:connect(function()
- newFrame.ItemNameLabel.Visible = true
- end)
- newFrame.ImageButton.MouseLeave:connect(function()
- newFrame.ItemNameLabel.Visible = false
- end)
- if itemInfo.quantity and 0 < itemInfo.quantity then
- newFrame.Quantity.Text = itemInfo.quantity
- end
- if itemData[itemInfo.name].itemType == "armor" then
- newFrame.Parent = mainGui.RightPanel.Inventory.List.ArmorFrame
- elseif itemData[itemInfo.name].itemType == "food" then
- newFrame.Parent = mainGui.RightPanel.Inventory.List.FoodFrame
- elseif itemData[itemInfo.name].itemType == "object" then
- newFrame.Parent = mainGui.RightPanel.Inventory.List.ObjectFrame
- elseif itemData[itemInfo.name].itemType == "tool" then
- newFrame.Parent = mainGui.RightPanel.Inventory.List.ToolFrame
- elseif itemData[itemInfo.name].itemType == "dropChest" then
- newFrame:Destroy()
- else
- newFrame.Parent = mainGui.RightPanel.Inventory.List.MiscFrame
- end
- newFrame.Visible = true
- end
- end
- end
- for _, categoryFrame in next, mainGui.RightPanel.Inventory.List:GetChildren() do
- if categoryFrame:IsA("Frame") then
- local frameSize = 100
- local totalFrames = #categoryFrame:GetChildren() - 1
- local numInRow = math.floor(categoryFrame.AbsoluteSize.X / 100)
- local columns = math.ceil(totalFrames / numInRow)
- categoryFrame.Size = UDim2.new(1, 0, 0, columns * 100)
- end
- end
- functionBank.UpdateBillboards()
- end,
- ToggleBusyTag = function(thing, toggle)
- if toggle then
- busyTags[thing] = tick()
- elseif busyTags[thing] then
- busyTags[thing] = nil
- end
- end,
- ClearBetweenPoints = function(pos1, pos2, ignoreTable)
- local ray = Ray.new(pos1, pos2 - pos1)
- local part, pos, norm, mat = workspace:FindPartOnRayWithIgnoreList(ray, ignoreTable)
- if part then
- return false
- else
- return true
- end
- end,
- GetDictionaryLength = function(tab)
- local count = 0
- for _, v in next, tab, nil do
- count = count + 1
- end
- return count
- end,
- SortToolbar = function()
- for _, v in next, mainGui.Panels.Toolbar.List:GetChildren() do
- if v:IsA("ImageButton") then
- if functionBank.GetDictionaryLength(data.toolbar[tonumber(v.Name)]) > 0 then
- v.Image = itemData[data.toolbar[tonumber(v.Name)].name].image
- else
- v.Image = ""
- end
- if tonumber(v.Name) == data.equipped then
- v.BackgroundColor3 = colorData.goodGreen
- else
- v.BackgroundColor3 = colorData.ironGrey
- end
- end
- end
- if not data.equipped then
- mainGui.Panels.Toolbar.Title.Visible = false
- elseif 0 < functionBank.GetDictionaryLength(data.toolbar[data.equipped]) then
- mainGui.Panels.Toolbar.Title.Visible = true
- mainGui.Panels.Toolbar.Title.Text = string.upper(data.toolbar[data.equipped].name)
- end
- end
- }
- functionBank.SortToolbar()
- functionBank.DrawInventory()
- functionBank.DrawCraftMenu()
- functionBank.DrawTribeGui()
- functionBank.DrawPatchNotes()
- functionBank.OpenGui(mainGui.Panels.Card.List.PatchNotes)
- functionBank.UpdateStats()
- for _, v in next, spawnGui.Customization.Appearance.HairFrame:GetChildren() do
- if v:IsA("ImageButton") then
- v.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- data.appearance.hair = v.Name
- rep.Events.CosmeticChange:FireServer(data.appearance)
- functionBank.UpdateMimic()
- end
- end)
- end
- end
- for _, v in next, spawnGui.Customization.Appearance.GenderFrame:GetChildren() do
- if v:IsA("ImageButton") then
- v.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- data.appearance.gender = v.Name
- rep.Events.CosmeticChange:FireServer(data.appearance)
- functionBank.UpdateMimic()
- end
- end)
- end
- end
- for _, v in next, spawnGui.Customization.Appearance.SkinFrame:GetChildren() do
- if v:IsA("ImageButton") then
- v.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- data.appearance.skin = v.Name
- rep.Events.CosmeticChange:FireServer(data.appearance)
- functionBank.UpdateMimic()
- end
- end)
- end
- end
- for _, v in next, spawnGui.Customization.Appearance.FaceFrame:GetChildren() do
- if v:IsA("ImageButton") then
- v.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- data.appearance.face = v.Name
- rep.Events.CosmeticChange:FireServer(data.appearance)
- functionBank.UpdateMimic()
- end
- end)
- end
- end
- spawnGui.Customization.PlayButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- data.hasSpawned = true
- cam.CameraType = Enum.CameraType.Custom
- rep.Events.SpawnFirst:FireServer()
- end
- end)
- for _, v in next, mainGui.Primary.Bag.Craft.Selection:GetChildren() do
- if v:IsA("TextButton") then
- v.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- else
- return
- end
- functionBank.SortCraftList(v.Name)
- functionBank.CreateSound(rep.Sounds.Quicks.UIToggle, player.PlayerGui)
- end)
- end
- end
- for _, v in next, mainGui.Panels.Card.List:GetChildren() do
- if v:IsA("Frame") then
- v.ImageButton.InputBegan:connect(function(input, gp)
- if functionBank.InteractInput(input, gp) then
- functionBank.OpenGui(v)
- end
- end)
- end
- end
- ghost = nil
- for _, v in next, mainGui.Panels.Toolbar.List:GetChildren() do
- if v:IsA("ImageButton") then
- v.DragBegin:connect(function(startPos)
- ghost = v:Clone()
- ghost.Size = UDim2.new(0, v.AbsoluteSize.X, 0, v.AbsoluteSize.Y)
- ghost.AnchorPoint = Vector2.new(0.5, 0.5)
- ghost.Parent = mainGui.TempEffects
- while ghost and run.RenderStepped:wait() do
- ghost.Position = UDim2.new(0, mouse.X, 0, mouse.Y)
- end
- end)
- v.DragStopped:connect(function(xEnd, yEnd)
- if ghost then
- ghost:Destroy()
- end
- local overlapsWith
- for _, otherButton in next, mainGui.Panels.Toolbar.List:GetChildren() do
- if otherButton:IsA("ImageButton") then
- local xmin, xmax, ymin, ymax = otherButton.AbsolutePosition.X, otherButton.AbsolutePosition.X + otherButton.AbsoluteSize.X, otherButton.AbsolutePosition.Y, otherButton.AbsolutePosition.Y + otherButton.AbsoluteSize.Y
- if xEnd >= xmin and xEnd <= xmax and yEnd >= ymin and yEnd <= ymax then
- overlapsWith = otherButton
- break
- end
- end
- end
- if overlapsWith == v then
- rep.Events.EquipTool:FireServer(tonumber(v.Name))
- elseif overlapsWith and overlapsWith ~= v then
- rep.Events.ToolSwap:FireServer(tonumber(v.Name), tonumber(overlapsWith.Name))
- elseif not overlapsWith then
- rep.Events.DropTool:FireServer(tonumber(v.Name))
- end
- end)
- v.InputBegan:connect(function(input, gp)
- if gp then
- return
- end
- if input.UserInputType == Enum.UserInputType.MouseButton2 and functionBank.GetDictionaryLength(data.toolbar[tonumber(v.Name)]) > 0 then
- rep.Events.Retool:FireServer(tonumber(v.Name))
- end
- end)
- end
- end
- function lerp(a, b, t)
- return a * (1 - t) + b * t
- end
- function ObjectWithinStuds(obj, studs)
- if studs >= (root.Position - obj.Position).magnitude then
- return true
- else
- return false
- end
- end
- function ScanArray(tab, element)
- for _, v in next, tab, nil do
- if v == element then
- return false
- end
- end
- return true
- end
- function FadeTrack(sound, duration, hold)
- local newTweenInfo = TweenInfo.new(duration or 5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, hold)
- local newGoal = {Volume = 0}
- local newTween = tweenService:Create(sound, newTweenInfo, newGoal)
- newTween:Play()
- end
- function PartsAlongRay(ray)
- local ignoreTable = {}
- local part, pos
- repeat
- part, pos = workspace:FindPartOnRayWithIgnoreList(ray, ignoreTable)
- if part ~= workspace.Terrain then
- ignoreTable[#ignoreTable + 1] = part
- end
- until not part or part == workspace.Terrain
- return ignoreTable
- end
- local determinePingAsync = coroutine.wrap(function()
- while wait(1) do
- local start = tick()
- local yieldFor = rep.Events.Pinger:InvokeServer()
- ping = math.clamp(tick() - start, 0, 0.3)
- end
- end)
- determinePingAsync()
- function SetupCharacter(newChar)
- char = newChar
- root, head, hum = newChar:WaitForChild("HumanoidRootPart"), newChar:WaitForChild("Head"), newChar:WaitForChild("Humanoid")
- cam = workspace.CurrentCamera
- cam.FieldOfView = 65
- game.Lighting.Bloom.Intensity = 0.6
- local newTweenInfo = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
- local newGoal = {Intensity = 0}
- local newTween = tweenService:Create(game.Lighting.Bloom, newTweenInfo, newGoal)
- newTween:Play()
- if not data.hasSpawned then
- cam.CameraType = Enum.CameraType.Scriptable
- playerGui.SpawnGui.Enabled = true
- playerGui.MainGui.Enabled = false
- 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)
- functionBank.UpdateMimic()
- return
- else
- cam.CameraType = Enum.CameraType.Custom
- playerGui.SpawnGui.Enabled = false
- playerGui.MainGui.Enabled = true
- end
- rep.Sounds.Music.BeautyMusic:Play()
- if not data.hasSpawned then
- FadeTrack(rep.Sounds.Music.BeautyMusic, 50, 30)
- spawn(function()
- wait(4)
- functionBank.MakeToast({
- title = "YOU:",
- message = "...Where am I?",
- color = colorData.brownUI,
- image = "",
- duration = 6
- })
- wait(6)
- if not data.hasSpawned then
- functionBank.MakeToast({
- title = "YOU:",
- message = "I should make a raft...",
- color = colorData.brownUI,
- image = "",
- duration = 8
- })
- wait(4)
- end
- if not data.hasSpawned then
- functionBank.CreateNotification("Press C to open your bag!", colorData.badRed, 4)
- end
- wait(14)
- if not data.hasSpawned then
- functionBank.CreateNotification(player.Name .. "! " .. "Press C to open your bag!", colorData.badRed, 6)
- end
- end)
- else
- FadeTrack(rep.Sounds.Music.BeautyMusic, 30, 0)
- end
- repeat
- if not char.Parent then
- wait()
- end
- until char.Parent == workspace
- cam.CameraType = Enum.CameraType.Custom
- hum.HealthChanged:connect(function()
- functionBank.UpdateStats()
- end)
- hum.StateChanged:connect(function()
- if hum:GetState() == Enum.HumanoidStateType.Seated then
- char.Head:FindFirstChild("Running"):Stop()
- end
- end)
- hum.Died:connect(function()
- end)
- hum:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)
- hum:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics, false)
- hum:SetStateEnabled(Enum.HumanoidStateType.PlatformStanding, false)
- camFocus = root
- moveAllowed = true
- charActive = true
- anims = {}
- local loadAnims = coroutine.wrap(function()
- for _, v in next, rep.Animations:GetChildren() do
- local newAnim = v:Clone()
- anims[v.Name] = hum:LoadAnimation(newAnim)
- wait()
- end
- end)
- loadAnims()
- local rotationCoroutine = coroutine.wrap(function()
- local bodyRotationGyro = rep.Misc.BodyRotationGyro:Clone()
- bodyRotationGyro.Parent = root
- bodyRotationGyro.AncestryChanged:connect(function()
- if not bodyRotationGyro:IsDescendantOf(char) and bodyRotationGyro.Parent ~= nil then
- print("BODYROTATION IS NOT DESCENDANT OF CHAR OR OF NIL")
- player:Kick()
- end
- end)
- while run.RenderStepped:wait() do
- if cam then
- local camPointOut = cam.CFrame * CFrame.new(0, 0, -1000)
- if charActive and root and not uis:IsKeyDown(Enum.KeyCode.LeftControl) then
- bodyRotationGyro.CFrame = CFrame.new(root.Position, camPointOut.p)
- end
- end
- end
- end)
- rotationCoroutine()
- end
- if player.Character then
- SetupCharacter(player.Character)
- end
- player.CharacterAdded:connect(function(newChar)
- SetupCharacter(newChar)
- newChar.DescendantAdded:connect(function(descendant)
- if descendant:IsA("BodyMover") and (not descendant:IsA("BodyGyro") or descendant.Parent ~= newChar.PrimaryPart) then
- error(player.Name, "removed")
- player:Kick()
- end
- if descendant:IsA("Tool") or descendant:IsA("HopperBin") then
- print("lmao f3x tools detected")
- player:Kick()
- end
- end)
- end)
- local selectionBox = Instance.new("SelectionBox")
- selectionBox.Parent = workspace
- selectionBox.Color3 = Color3.fromRGB(170, 255, 0)
- run.RenderStepped:connect(function()
- mainGui.Panels.MouseFrame.Position = UDim2.new(0, mouse.X + 40, 0, mouse.Y + 10)
- if charActive and root then
- local ray = Ray.new(root.Position + Vector3.new(0, 5, 0), Vector3.new(0, -15, 0))
- local part, pos, norm, mat = workspace:FindPartOnRay(ray, char)
- if mat == Enum.Material.Water then
- hum.WalkSpeed = currentWalkSpeed / 2.5
- else
- hum.WalkSpeed = currentWalkSpeed
- end
- end
- if not data.hasSpawned then
- hum.WalkSpeed = 0
- hum.JumpPower = 0
- end
- if charActive and root and head then
- if (cam.CFrame.p - head.Position).magnitude < 1.5 and data.equipped then
- for _, v in next, char:GetDescendants() do
- if v:IsA("BasePart") then
- if v.Name ~= "GhostRightArm" and v.Parent.Name ~= data.toolbar[data.equipped].name then
- v.LocalTransparencyModifier = 1
- else
- v.LocalTransparencyModifier = 0
- end
- end
- end
- elseif char:FindFirstChild("GhostRightArm") then
- char.GhostRightArm.LocalTransparencyModifier = 1
- end
- end
- if charActive and root then
- if mouse.Target then
- if mouse.Target:FindFirstChild("Draggable") or mouse.Target.Parent:FindFirstChild("Draggable") or dragObject or mouse.Target:FindFirstChild("DoorButton") then
- if ObjectWithinStuds(mouse.Target, 25) then
- mouse.Icon = "http://www.roblox.com/asset/?id=455570287"
- else
- mouse.Icon = ""
- selectionBox.Adornee = nil
- end
- elseif mouse.Target.Parent:FindFirstChild("Interactable") then
- if mouse.Target.Parent:FindFirstChild("InteractPart") then
- selectionBox.Adornee = mouse.Target.Parent.InteractPart
- else
- selectionBox.Adornee = mouse.Target.Parent
- end
- mouse.Icon = "http://www.roblox.com/asset/?id=455570287"
- 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
- mouse.Icon = "rbxassetid://117431027"
- else
- mouse.Icon = ""
- selectionBox.Adornee = nil
- end
- local targName
- if mouse.Target:FindFirstChild("Pickup") then
- targName = mouse.Target.Name
- elseif mouse.Target.Parent:FindFirstChild("Pickup") then
- targName = mouse.Target.Parent.Name
- end
- if targName and ObjectWithinStuds(mouse.Target, 25) then
- mainGui.Panels.MouseFrame.Title.Text = targName
- mainGui.Panels.MouseFrame.ELabel.Text = "F - harvest"
- mainGui.Panels.MouseFrame.Visible = true
- if itemData[targName] and itemData[targName].nourishment then
- mainGui.Panels.MouseFrame.FLabel.Text = "E - eat"
- elseif mouse.Target.Material == Enum.Material.Water then
- mainGui.Panels.MouseFrame.FLabel.Text = "E - drink"
- else
- mainGui.Panels.MouseFrame.FLabel.Text = ""
- end
- else
- mainGui.Panels.MouseFrame.Visible = false
- end
- else
- mouse.Icon = ""
- selectionBox.Adornee = nil
- end
- else
- mouse.Icon = ""
- selectionBox.Adornee = nil
- end
- end)
- local draggerBodyPos
- function DragFunction()
- if not draggerBodyPos then
- draggerBodyPos = Instance.new("BodyPosition")
- draggerBodyPos.Parent = dragObject
- draggerBodyPos.P = 25000
- draggerBodyPos.D = 1500
- draggerBodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- draggerBodyPos.AncestryChanged:connect(function()
- if not draggerBodyPos or not draggerBodyPos.Parent then
- draggerBodyPos = nil
- end
- end)
- end
- if dragObject and draggerBodyPos then
- if dragObject.Parent and dragObject.Parent:IsA("Model") and dragObject.Parent ~= workspace then
- mouse.TargetFilter = dragObject.Parent
- else
- mouse.TargetFilter = dragObject
- end
- if dragObject:FindFirstChild("Draggable") or dragObject.Parent and dragObject.Parent:FindFirstChild("Draggable") then
- local reachRay = Ray.new(root.Position, (mouse.Hit.p - root.Position).unit * math.clamp((root.Position - mouse.Hit.p).magnitude, 3, 30))
- local part, pos = workspace:FindPartOnRayWithIgnoreList(reachRay, PartsAlongRay(reachRay))
- draggerBodyPos.Position = pos + Vector3.new(0, dragObject.Size.Y / 2, 0)
- end
- end
- end
- local hotkeyBank = {
- pickup = Enum.KeyCode.F,
- eat = Enum.KeyCode.E,
- rotate = Enum.KeyCode.R,
- toggleBag = Enum.KeyCode.C,
- toggleTribe = Enum.KeyCode.T,
- togglePatchNotes = Enum.KeyCode.X,
- toggleShop = Enum.KeyCode.Z
- }
- uis.InputBegan:connect(function(input, gp)
Add Comment
Please, Sign In to add comment