Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Confirmation Dialog OnClick
- local itemModule = require(game.ReplicatedStorage.Modules.ItemsModule)
- local button = script.Parent
- local active = false
- local function SetCraftButton(playerData, itemName)
- local craftingModule = require(game.ReplicatedStorage.Modules.CraftingModule)
- local craftButton = button.Parent.Parent.CraftingFrame.Craft
- local canCraft = button.Parent.Parent.CraftingFrame.CanCraft
- local dialogSettings = require(game.StarterGui.DialogSettingsModule)
- local craftingItem = itemModule:GetItemByName(itemName)
- if craftingModule.CanCraftItem(playerData, craftingItem) then
- canCraft.Value = true
- craftButton.BackgroundColor3 = dialogSettings.GreenButtonColor3
- else
- canCraft.Value = false
- craftButton.BackgroundColor3 = dialogSettings.GrayButtonColor3
- end
- end
- local function OnYesClick()
- local canCraftValue = button.Parent.Parent.CraftingFrame.CanCraft.Value
- if active == false and canCraftValue then
- active = true
- local selected = button.Parent.Parent.CraftingFrame.SelectedName
- local craftItemFunction = game.ReplicatedStorage.Crafting.CraftItemFunction
- local response = craftItemFunction:InvokeServer(selected.Value)
- local player = game.Players.LocalPlayer
- local playerDataFromServer = game.ReplicatedStorage.PlayerData.PlayerDataFromServerFunction
- local playerData = playerDataFromServer:InvokeServer()
- _G.PlayerData[player.UserId] = playerData
- local optionsDialogFrame = button.Parent
- optionsDialogFrame.Visible = false
- --SetCraftButton(playerData,selected.Value)
- local confirmationFrame = button.Parent.Parent.ConfirmationFrame
- confirmationFrame.Content.Text = response
- confirmationFrame.Visible = true
- active = false
- end
- end
- button.MouseButton1Click:Connect(OnYesClick)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement