BumpyPlayz

Sidemenu Button Tool Shop Gui

Feb 5th, 2020
138,838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2.  
  3. script.Parent.MouseButton1Click:Connect(function()
  4.     local item = script.Parent.Parent.Parent.NameOftool.TextLabel.Text
  5.    
  6.     if script.Parent.Text == "Buy" then
  7.         game.ReplicatedStorage.Remotes.BoughtTool:FireServer(item)
  8.     elseif script.Parent.Text == "Equip" then
  9.         game.ReplicatedStorage.Remotes.EquipTool:FireServer(item)
  10.     end
  11.    
  12. end)
  13.  
  14.  
  15. game.ReplicatedStorage.Remotes.BoughtTool.OnClientEvent:Connect(function(item)
  16.    
  17.     game.ReplicatedStorage.Remotes.EquipTool:FireServer(item)
  18.     print("Recieves")
  19.     local number = 0
  20.     for i,v in pairs(script.Parent.Parent.Parent.Parent.ScrollingFrame_12.ScrollingFrame:GetChildren()) do
  21.         if v:FindFirstChild("ToolName") then
  22.             if v.ToolName.Value == item then
  23.                 number = tonumber(v.Name)
  24.             end
  25.         end
  26.     end
  27.    
  28.     if number ~=nil then
  29.         for i,v in pairs(script.Parent.Parent.Parent.Parent.ScrollingFrame_12.ScrollingFrame:GetChildren()) do
  30.             if v:FindFirstChild("ToolName") then
  31.                 local thenumber = tonumber(v.Name)
  32.                 if thenumber <=number or thenumber == number +1 then
  33.                     v.ToolImageDisp.ImageLabel.ImageColor3 = Color3.fromRGB(255,255,255)
  34.                 end
  35.             end
  36.         end
  37.     end
  38.    
  39.     for i, v in pairs(script.Parent.Parent.Parent.Parent.ScrollingFrame_12.ScrollingFrame:GetChildren()) do
  40.         if v:FindFirstChild("ToolName") then
  41.             if v.ToolImageDisp.ImageLabel.Image == script.Parent.Parent.Parent.ImageOftool.Image then
  42.                 if v.ToolImageDisp.ImageLabel.ImageColor3 == Color3.fromRGB(255,255,255) then
  43.                     script.Parent.Parent.Parent.ImageOftool.ImageColor3 = Color3.fromRGB(255,255,255)
  44.                 end
  45.             end
  46.         end
  47.     end
  48.    
  49.  
  50. end)
  51.  
  52. game.ReplicatedStorage.Remotes.EquipTool.OnClientEvent:Connect(function(item)
  53.     if script.Parent.Parent.Parent.NameOftool.TextLabel.Text == item then
  54.         script.Parent.Text = "Equipped"
  55.     end
  56.    
  57. end)
Add Comment
Please, Sign In to add comment