Forum > Scripts >

Prison royale spawn gui

Posts: 40

Threads: 25

Joined: Apr, 2018

Reputation: 0

Posted

-- ////////////// Prison Royale GUI /////// By: Chilled //////

local Plr = game:GetService("Players").LocalPlayer

local GUI = game:GetObjects("rbxassetid://1086440185")[1]
GUI.Parent = game:GetService("CoreGui")

--local GUI = script.Parent:WaitForChild("ScreenGui")

local Search = GUI:WaitForChild("Holdr").Main.Search
local Scroll = GUI:WaitForChild("Holdr").Main.Scroll

local Loot = workspace.Loot

-- //////////////////////////////////////////////////////

local Pos = 0
local SPos = 0

local Objects = {}

local print = function(Str)
	print("[PR] - " .. Str)
end

local ClearObjects = function()
	local k = 1
	while Objects[k] do
		Objects[k] = nil
		k = k + 1
	end
	Objects = {}
end

local ResetGUI = function()
	Pos = 0
	SPos = 0
	Scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
	for i,v in pairs(Scroll:GetChildren()) do
		v:Destroy()
	end
end

local DefaultSearch = function()
	ResetGUI()
	ClearObjects()
	local Tag = 1
	for i,v in pairs(Loot:GetChildren()) do
		table.insert(Objects, {Tag, v})
		local x = Instance.new("TextButton", Scroll)
		x.BackgroundColor3 = Color3.fromRGB(38, 38, 38)
		x.BorderColor3 = Color3.fromRGB(255, 255, 255)
		x.Position = UDim2.new(0, 0, 0, Pos)
		x.Size = UDim2.new(1, 0, 0, 20)
		x.Name = Tag
		x.Text = v.Name
		x.TextScaled = true
		x.TextColor3 = Color3.fromRGB(255, 255, 255)
		x.TextXAlignment = Enum.TextXAlignment.Left
		Scroll.CanvasSize = Scroll.CanvasSize + UDim2.new(0, 0, 0, SPos)
		
		x.MouseButton1Down:connect(function()
			for i,v in pairs(Objects) do
				if tostring(Objects[i][1]) == x.Name then
					Objects[i][2]:MoveTo(Plr.Character.Head.Position)
				end
			end
		end)
		
		Pos = Pos + 24
		SPos = SPos + 2
		Tag = Tag + 1
	end
end

DefaultSearch()

Search.FocusLost:connect(function(k)
	if k then
		if Search.Text:match("%w") then
			ResetGUI()
			ClearObjects()
			local Tag = 1
			for i,v in pairs(Loot:GetChildren()) do
				if (v.Name:lower():find(Search.Text:lower())) then
					table.insert(Objects, {Tag, v})
					local x = Instance.new("TextButton", Scroll)
					x.BackgroundColor3 = Color3.fromRGB(38, 38, 38)
					x.BorderColor3 = Color3.fromRGB(255, 255, 255)
					x.Position = UDim2.new(0, 0, 0, Pos)
					x.Size = UDim2.new(1, 0, 0, 20)
					x.Name = Tag
					x.Text = v.Name
					x.TextScaled = true
					x.TextColor3 = Color3.fromRGB(255, 255, 255)
					x.TextXAlignment = Enum.TextXAlignment.Left
					Scroll.CanvasSize = Scroll.CanvasSize + UDim2.new(0, 0, 0, SPos)
					
					x.MouseButton1Down:connect(function()
						for i,v in pairs(Objects) do
							if tostring(Objects[i][1]) == x.Name then
								Objects[i][2]:MoveTo(Plr.Character.Head.Position)
							end
						end
					end)
					
					Pos = Pos + 24
					SPos = SPos + 2
					Tag = Tag + 1
				end
			end
		else
			DefaultSearch()
		end
	end
end)

-- ///////////////////////////////////////////

print("Prison Royale GUI Loaded")
  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )