Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// Services
- local Players = game:GetService("Players")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- --// Assets
- local Remotes = ReplicatedStorage:WaitForChild("Remotes")
- local ClassEvent = Remotes:WaitForChild("Class")
- local DataEvent = Remotes:WaitForChild("Data")
- local Modules = ReplicatedStorage:WaitForChild("Modules")
- local ClassInfo = require(Modules:WaitForChild("Class Info"))
- local Hotbar = require(script.Parent:WaitForChild("Hotbar"))
- --// Variables
- local Player = Players.LocalPlayer
- local PlayerGui = Player:WaitForChild("PlayerGui")
- local Gui = PlayerGui:WaitForChild("Character Selection")
- local Background = Gui:WaitForChild("Background")
- local Select = Background:WaitForChild("Select")
- local Price = Select:WaitForChild("Price")
- local Cash = Background:WaitForChild("Cash")
- local Selected = {
- Character = "",
- Anime = "",
- }
- local PlayerData = nil
- --// Module
- local module = {
- Enable = function()
- Gui.Enabled = true
- local BackgroundAssets = Background:GetDescendants()
- for index = 1,#BackgroundAssets do
- local Button = BackgroundAssets[index]
- if Button:IsA("TextButton") or Button:IsA("ImageButton") then
- if Button.Name == "Select" then return end
- Button.MouseButton1Click:Connect(function()
- if Selected.Character == Button.Name or Selected.Anime == Button.Parent.Name then
- Selected.Character = nil
- Selected.Anime = nil
- Select.Text = ""
- Price.Visible = false
- Price.Text = ""
- else
- if PlayerData.Characters[Button.Parent.Name][Button.Name] == "Locked" then
- Selected.Character = Button.Name
- Selected.Anime = Button.Parent.Name
- Select.Text = "Buy"
- Price.Visible = true
- Price.Text = ClassInfo[Button.Parent.Name][Button.Name].Price
- else
- Selected.Character = Button.Name
- Selected.Anime = Button.Parent.Name
- Select.Text = "Select"
- Price.Visible = false
- Price.Text = ""
- end
- end
- end)
- end
- end
- end,
- Toggle = function(Task)
- if Task == "On" then
- Gui.Enabled = true
- elseif Task == "Off" then
- Gui.Enabled = false
- end
- end
- }
- --// Main
- Select.MouseButton1Click:Connect(function()
- if Selected.Character or Selected.Anime == nil then return end
- if PlayerData.Characters[Selected.Anime][Selected.Character] == "Unlocked" then
- ClassEvent:FireServer({Selected.Anime, Selected.Character})
- else
- end
- end)
- DataEvent.OnClientEvent:Connect(function(Data)
- PlayerData = Data
- Cash.Text = Data.Stats.Cash
- end)
- module.Enable()
- return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement