Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- script.Parent.MouseButton1Click:Connect(function()
- local item = script.Parent.Parent.Parent.NameOftool.TextLabel.Text
- if script.Parent.Text == "Buy" then
- game.ReplicatedStorage.Remotes.BoughtTool:FireServer(item)
- elseif script.Parent.Text == "Equip" then
- game.ReplicatedStorage.Remotes.EquipTool:FireServer(item)
- end
- end)
- game.ReplicatedStorage.Remotes.BoughtTool.OnClientEvent:Connect(function(item)
- game.ReplicatedStorage.Remotes.EquipTool:FireServer(item)
- print("Recieves")
- local number = 0
- for i,v in pairs(script.Parent.Parent.Parent.Parent.ScrollingFrame_12.ScrollingFrame:GetChildren()) do
- if v:FindFirstChild("ToolName") then
- if v.ToolName.Value == item then
- number = tonumber(v.Name)
- end
- end
- end
- if number ~=nil then
- for i,v in pairs(script.Parent.Parent.Parent.Parent.ScrollingFrame_12.ScrollingFrame:GetChildren()) do
- if v:FindFirstChild("ToolName") then
- local thenumber = tonumber(v.Name)
- if thenumber <=number or thenumber == number +1 then
- v.ToolImageDisp.ImageLabel.ImageColor3 = Color3.fromRGB(255,255,255)
- end
- end
- end
- end
- for i, v in pairs(script.Parent.Parent.Parent.Parent.ScrollingFrame_12.ScrollingFrame:GetChildren()) do
- if v:FindFirstChild("ToolName") then
- if v.ToolImageDisp.ImageLabel.Image == script.Parent.Parent.Parent.ImageOftool.Image then
- if v.ToolImageDisp.ImageLabel.ImageColor3 == Color3.fromRGB(255,255,255) then
- script.Parent.Parent.Parent.ImageOftool.ImageColor3 = Color3.fromRGB(255,255,255)
- end
- end
- end
- end
- end)
- game.ReplicatedStorage.Remotes.EquipTool.OnClientEvent:Connect(function(item)
- if script.Parent.Parent.Parent.NameOftool.TextLabel.Text == item then
- script.Parent.Text = "Equipped"
- end
- end)
Add Comment
Please, Sign In to add comment