View difference between Paste ID: eZPDbS8x and UPHpmJFQ
SHOW: | | - or go back to the newest paste.
1
-- Game Link: https://www.roblox.com/games/480485987/Survival-303#
2
3
local function createGui()
4
	local f = game.CoreGui.RobloxGui.ControlFrame
5
	local tb = Instance.new("TextBox", f)
6
	tb.Size = UDim2.new(0.12, 0, 0.05, 0)
7
	tb.Position = UDim2.new(0, 0, 0.65, 0)
8
	local tl = Instance.new("TextButton", f)
9
	tl.Size = UDim2.new(0.12, 0, 0.05, 0)
10
	tl.Position = UDim2.new(0, 0, 0.7, 0)
11
	return {tb, tl}
12
end
13
14
local gui = createGui()
15
local tb = gui[1]
16
local tl = gui[2]
17
18
local function tn(number)
19
    return math.floor(tonumber(number) or error("Could not cast '" .. tostring(number) .. "' to number.'"))
20
end
21
22
local function getObj(name)
23
	for _,v in pairs(workspace:GetDescendants()) do
24
		if (v.Name == name and not v:FindFirstChild("NoForage") and not v.Parent:FindFirstChild("NoForage")) then 
25
			local val = game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.CoverFrame.Slots.Text
26
			local f = val:sub(0, val:find("/")-1)
27
			local s = val:sub(val:find("/") + 1, val:find("/")+2)
28
			if (tn(f) ~= tn(s)) then
29
				game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(v.Position)
30
				wait(1)
31
				game.ReplicatedStorage.StarterTools.Gather.GatherAttempt:InvokeServer(v, v.Position)
32
				break
33
			else
34
				tb.Text = "Inventory full!"
35
				break
36
			end
37
		end
38
	end
39
end
40
41
local gl = {}
42
for _,v in pairs(workspace:GetDescendants()) do 
43
	if v:IsA("Part") and not v:FindFirstChild("NoForage") and not v.Parent:FindFirstChild("NoForage") then 
44
		gl[#gl + 1] = v
45
	end
46
end
47
48
tb.Changed:connect(function()
49
	if (tb.Text ~= "") then
50
		for _,v in pairs(gl) do 
51
			if v.Name:lower():find(tb.Text:lower()) then 
52
				tl.Text = v.Name
53
				break
54
			else
55
				tl.Text = ""
56
			end
57
		end
58
	end
59
end)
60
61
tl.MouseButton1Down:connect(function()
62
	getObj(tl.Text)
63
end)