Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Game Link: https://www.roblox.com/games/480485987/Survival-303#
- local function createGui()
- local f = game.CoreGui.RobloxGui.ControlFrame
- local tb = Instance.new("TextBox", f)
- tb.Size = UDim2.new(0.12, 0, 0.05, 0)
- tb.Position = UDim2.new(0, 0, 0.65, 0)
- local tl = Instance.new("TextButton", f)
- tl.Size = UDim2.new(0.12, 0, 0.05, 0)
- tl.Position = UDim2.new(0, 0, 0.7, 0)
- return {tb, tl}
- end
- local gui = createGui()
- local tb = gui[1]
- local tl = gui[2]
- local function tn(number)
- return math.floor(tonumber(number) or error("Could not cast '" .. tostring(number) .. "' to number.'"))
- end
- local function getObj(name)
- for _,v in pairs(workspace:GetDescendants()) do
- if (v.Name == name and not v:FindFirstChild("NoForage") and not v.Parent:FindFirstChild("NoForage")) then
- local val = game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.CoverFrame.Slots.Text
- local f = val:sub(0, val:find("/")-1)
- local s = val:sub(val:find("/") + 1, val:find("/")+2)
- if (tn(f) ~= tn(s)) then
- game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(v.Position)
- wait(1)
- game.ReplicatedStorage.StarterTools.Gather.GatherAttempt:InvokeServer(v, v.Position)
- break
- else
- tb.Text = "Inventory full!"
- break
- end
- end
- end
- end
- local gl = {}
- for _,v in pairs(workspace:GetDescendants()) do
- if v:IsA("Part") and not v:FindFirstChild("NoForage") and not v.Parent:FindFirstChild("NoForage") then
- gl[#gl + 1] = v
- end
- end
- tb.Changed:connect(function()
- if (tb.Text ~= "") then
- for _,v in pairs(gl) do
- if v.Name:lower():find(tb.Text:lower()) then
- tl.Text = v.Name
- break
- else
- tl.Text = ""
- end
- end
- end
- end)
- tl.MouseButton1Down:connect(function()
- getObj(tl.Text)
- end)
Add Comment
Please, Sign In to add comment