BumpyPlayz

Arranger Tool Shop Gui

Feb 5th, 2020
2,866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.39 KB | None | 0 0
  1. game.ReplicatedStorage.Remotes.PlayerLoaded:FireServer()
  2. print("PlayerLoaded")
  3. local player = game.Players.LocalPlayer
  4. local number = 1
  5. game.ReplicatedStorage.Remotes.BeginArrangement.OnClientEvent:Connect(function()
  6.     print("Got")
  7.     repeat
  8.         local image = game.ReplicatedStorage.ToolsImage:FindFirstChild(number)
  9.         if image:IsA("ImageLabel") then
  10.             print(image.Name)
  11.             local clone = game.ReplicatedStorage.Template:Clone()
  12.             clone.ToolImageDisp.ImageLabel.Image = image.Image
  13.             clone.Name = image.Name
  14.             clone.CostDisplay.Value = image.Cost.Value
  15.             clone.ToolName.Value = image.ToolName.Value
  16.             clone.Parent = script.Parent
  17.             clone.ToolImageDisp.ImageLabel.ImageColor3 = Color3.fromRGB(0,0,0)
  18.            
  19.             if clone.Name == "1" then
  20.                 local sidemenu = script.Parent.Parent.Parent.SideMenu
  21.                 sidemenu.ImageOftool.Image = image.Image
  22.                 sidemenu.ImageOftool.ImageColor3 = Color3.fromRGB(255,255,255)
  23.                 sidemenu.BuyButton.TextButton.Text = "Equip"
  24.                 sidemenu.Cost.CostOfTool.Value = 0
  25.                 sidemenu.Cost.CostDisplayer.Text = "Cost : 0"
  26.                 sidemenu.NameOftool.TextLabel.Text = clone.ToolName.Value
  27.                
  28.             end
  29.            
  30.             if player.OwnedItems:FindFirstChild(clone.ToolName.Value) then
  31.                 clone.ToolImageDisp.ImageLabel.ImageColor3 = Color3.fromRGB(255,255,255)
  32.             end
  33.            
  34.             local equipped = player:WaitForChild("Equipped")
  35.             if equipped.Value~= nil then
  36.                 if clone.ToolName.Value == equipped.Value then
  37.                     local sidemenu = script.Parent.Parent.Parent.SideMenu
  38.                     sidemenu.ImageOftool.Image = image.Image
  39.                     sidemenu.ImageOftool.ImageColor3 = Color3.fromRGB(255,255,255)
  40.                     sidemenu.BuyButton.TextButton.Text = "Equipped"
  41.                     sidemenu.Cost.CostOfTool.Value = clone.CostDisplay.Value
  42.                     sidemenu.Cost.CostDisplayer.Text = "Cost : "..sidemenu.Cost.CostOfTool.Value
  43.                     sidemenu.NameOftool.TextLabel.Text = clone.ToolName.Value
  44.                     game.ReplicatedStorage.Remotes.EquipTool:FireServer(equipped.Value)
  45.                 end
  46.             end
  47.            
  48.             local number = tonumber(clone.Name)
  49.             if number ~= 1 then
  50.                 local previousnum = number-1
  51.                 local itemfound = script.Parent:FindFirstChild(previousnum)
  52.                 if itemfound then
  53.                     if player.OwnedItems:FindFirstChild(itemfound.ToolName.Value) then
  54.                         clone.ToolImageDisp.ImageLabel.ImageColor3 = Color3.fromRGB(255,255,255)
  55.                     end
  56.                 end
  57.             end
  58.         end
  59.         number = number+1
  60.     until number == game.ReplicatedStorage.TotalTools.Value + 1
  61. end)
Add Comment
Please, Sign In to add comment