| |
|
| |
|
| | local Players = game:GetService("Players")
|
| | local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
| |
|
| | local ShopConfig = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("ShopConfig"))
|
| | local ChoppingConfig = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("ChoppingConfig"))
|
| | local EquipToolEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("EquipToolEvent")
|
| | local NotificationEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("NotificationEvent")
|
| |
|
| |
|
| | local function onEquipTool(player, toolId)
|
| | if not toolId or type(toolId) ~= "string" then return end
|
| |
|
| |
|
| | if not ChoppingConfig.AxeTypes[toolId] then return end
|
| |
|
| |
|
| | if not _G.HasInInventory(player, "Tools", toolId) then
|
| | NotificationEvent:FireClient(player, "Error", "You don't own this tool!")
|
| | return
|
| | end
|
| |
|
| |
|
| | local data = _G.GetPlayerData(player)
|
| | if data then
|
| | data.EquippedAxe = toolId
|
| | player:SetAttribute("EquippedAxe", toolId)
|
| |
|
| |
|
| | local character = player.Character
|
| | if character then
|
| | character:SetAttribute("EquippedAxe", toolId)
|
| | end
|
| |
|
| | NotificationEvent:FireClient(player, "Equipped", "Equipped " .. toolId)
|
| | end
|
| | end
|
| |
|
| | EquipToolEvent.OnServerEvent:Connect(onEquipTool)
|
| |
|