Advertisement
Guest User

dayz spawn items

a guest
Jan 27th, 2020
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.93 KB | None | 0 0
  1. -- [Spawn GUI]
  2.  
  3. local spawner = Instance.new("ScreenGui")
  4. local Main = Instance.new("Frame")
  5. local ItemFrame = Instance.new("ScrollingFrame")
  6. local ItemSearch = Instance.new("TextBox")
  7. local SpawnButton = Instance.new("TextButton")
  8. local Title = Instance.new("TextLabel")
  9.  
  10.  
  11. spawner.Name = "spawner"
  12. spawner.Parent = game.CoreGui
  13.  
  14. Main.Name = "Main"
  15. Main.Parent = spawner
  16. Main.BackgroundColor3 = Color3.new(0.701961, 0.701961, 0.701961)
  17. Main.BorderSizePixel = 0
  18. Main.Position = UDim2.new(0, 667, 0, 228)
  19. Main.Size = UDim2.new(0, 266, 0, 244)
  20. Main.Active = true
  21. Main.Draggable = true
  22.  
  23. ItemFrame.Name = "ItemFrame"
  24. ItemFrame.Parent = Main
  25. ItemFrame.BackgroundColor3 = Color3.new(0.317647, 0.317647, 0.317647)
  26. ItemFrame.BorderSizePixel = 0
  27. ItemFrame.Position = UDim2.new(0, 56, 0, 76)
  28. ItemFrame.Size = UDim2.new(0, 155, 0, 92)
  29. ItemFrame.BottomImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  30. ItemFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
  31. ItemFrame.TopImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  32.  
  33. ItemSearch.Name = "ItemSearch"
  34. ItemSearch.Parent = Main
  35. ItemSearch.BackgroundColor3 = Color3.new(0.533333, 0.533333, 0.533333)
  36. ItemSearch.BorderSizePixel = 0
  37. ItemSearch.Position = UDim2.new(0, 56, 0, 53)
  38. ItemSearch.Size = UDim2.new(0, 155, 0, 25)
  39. ItemSearch.Font = Enum.Font.SourceSansBold
  40. ItemSearch.FontSize = Enum.FontSize.Size14
  41. ItemSearch.Text = "Search for an item!"
  42. ItemSearch.TextColor3 = Color3.new(1, 1, 1)
  43. ItemSearch.TextScaled = true
  44. ItemSearch.TextSize = 14
  45. ItemSearch.TextWrapped = true
  46.  
  47. SpawnButton.Name = "SpawnButton"
  48. SpawnButton.Parent = Main
  49. SpawnButton.BackgroundColor3 = Color3.new(0.027451, 1, 0.482353)
  50. SpawnButton.BorderSizePixel = 0
  51. SpawnButton.Position = UDim2.new(0, 34, 0, 186)
  52. SpawnButton.Size = UDim2.new(0, 199, 0, 35)
  53. SpawnButton.ZIndex = 2
  54. SpawnButton.AutoButtonColor = false
  55. SpawnButton.Font = Enum.Font.ArialBold
  56. SpawnButton.FontSize = Enum.FontSize.Size14
  57. SpawnButton.Text = "SPAWN"
  58. SpawnButton.TextColor3 = Color3.new(1, 1, 1)
  59. SpawnButton.TextScaled = true
  60. SpawnButton.TextSize = 14
  61. SpawnButton.TextWrapped = true
  62.  
  63. Title.Name = "Title"
  64. Title.Parent = Main
  65. Title.BackgroundColor3 = Color3.new(1, 1, 1)
  66. Title.BackgroundTransparency = 1
  67. Title.BorderSizePixel = 0
  68. Title.Size = UDim2.new(0, 266, 0, 30)
  69. Title.Font = Enum.Font.SourceSansBold
  70. Title.FontSize = Enum.FontSize.Size14
  71. Title.Text = "DeadWinter"
  72. Title.TextColor3 = Color3.new(1, 1, 1)
  73. Title.TextScaled = true
  74. Title.TextSize = 14
  75. Title.TextWrapped = true
  76.  
  77. local backgroundObjects = Instance.new('Folder', spawner.Main)
  78. backgroundObjects.Name = 'BackgroundObjects'
  79.  
  80. local SpawnButton = Instance.new("TextButton", backgroundObjects)
  81. SpawnButton.Name = "SpawnButton"
  82. SpawnButton.Parent = game.CoreGui.spawner.Main.BackgroundObjects
  83. SpawnButton.BackgroundColor3 = Color3.new(0.0196078, 0.729412, 0.34902)
  84. SpawnButton.BorderSizePixel = 0
  85. SpawnButton.Position = UDim2.new(0, 34, 0, 193)
  86. SpawnButton.Size = UDim2.new(0, 199, 0, 35)
  87. SpawnButton.AutoButtonColor = false
  88. SpawnButton.Font = Enum.Font.SourceSans
  89. SpawnButton.FontSize = Enum.FontSize.Size14
  90. SpawnButton.Text = ""
  91. SpawnButton.TextSize = 14
  92.  
  93. local gui = spawner.Main
  94. local box = gui:WaitForChild('ItemSearch')
  95. local items = gui:WaitForChild('ItemFrame')
  96. local path = Game.Lighting.assets.itemModels
  97. local btn = gui:WaitForChild('SpawnButton')
  98. local pos = gui:WaitForChild('BackgroundObjects').SpawnButton.Position
  99.  
  100.  
  101. local function search(text)
  102. local items = {}
  103. for i, v in next, path:GetChildren() do
  104. if text:upper() == v.Name:sub(1, string.len(text)):upper() then
  105. table.insert(items, v.Name)
  106. end
  107. end
  108. return items
  109. end
  110.  
  111. local function bind(thing, f)
  112. thing.MouseButton1Click:connect(function()
  113. f()
  114. end)
  115. end
  116.  
  117. box.Changed:connect(function()
  118. local list = search(box.Text)
  119. if box.Text:gsub("", "") == "" then
  120. items.CanvasSize = UDim2.new(0, 0, 0, 0)
  121. items:ClearAllChildren()
  122. return
  123. end
  124. items.CanvasSize = UDim2.new(0, 0, 0, 0)
  125. items:ClearAllChildren()
  126. for i, v in next, list do
  127. local yPos = ((20 * i) - 20)
  128. local s = Instance.new('TextButton', items)
  129. s.BorderSizePixel = 0
  130. s.Font = Enum.Font.ArialBold
  131. s.TextScaled = true
  132. s.Text = v
  133. s.Name = v
  134. s.BackgroundColor3 = Color3.fromRGB(211, 211, 211)
  135. s.TextColor3 = Color3.new(0, 0, 0)
  136. s.Size = UDim2.new(0, 155, 0, 20)
  137. s.Position = UDim2.new(0, 0, 0, yPos)
  138. bind(s, function()
  139. box.Text = s.Text
  140. items:ClearAllChildren()
  141. items.CanvasSize = UDim2.new(0, 0, 0, 0)
  142. end)
  143. end
  144. items.CanvasSize = UDim2.new(0, 0, 0, (20 * #list))
  145. end)
  146.  
  147. local People = game.Players.LocalPlayer.Name
  148. btn.MouseButton1Click:connect(function()
  149. game.Workspace.resources.events.createItemInWorld:FireServer(49,box.Text,Game.Workspace[People].Torso.CFrame,100)
  150. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement