Download src/ServerScriptService/InventoryManager.server.lua from algorembrant/TimberWoods: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/algorembrant/TimberWoods/resolve/main/src/ServerScriptService/InventoryManager.server.lua
- Command line
-
hf download hf://algorembrant/TimberWoods/src/ServerScriptService/InventoryManager.server.lua
-
curl -L -o InventoryManager.server.lua https://huggingface.co/algorembrant/TimberWoods/resolve/main/src/ServerScriptService/InventoryManager.server.lua
1.46 kB
| -- src/ServerScriptService/InventoryManager.server.lua | |
| 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") | |
| -- Handle equip tool requests from client | |
| local function onEquipTool(player, toolId) | |
| if not toolId or type(toolId) ~= "string" then return end | |
| -- Validate the tool exists in configs | |
| if not ChoppingConfig.AxeTypes[toolId] then return end | |
| -- Validate the player owns the tool | |
| if not _G.HasInInventory(player, "Tools", toolId) then | |
| NotificationEvent:FireClient(player, "Error", "You don't own this tool!") | |
| return | |
| end | |
| -- Update the equipped axe | |
| local data = _G.GetPlayerData(player) | |
| if data then | |
| data.EquippedAxe = toolId | |
| player:SetAttribute("EquippedAxe", toolId) | |
| -- Update character attribute | |
| local character = player.Character | |
| if character then | |
| character:SetAttribute("EquippedAxe", toolId) | |
| end | |
| NotificationEvent:FireClient(player, "Equipped", "Equipped " .. toolId) | |
| end | |
| end | |
| EquipToolEvent.OnServerEvent:Connect(onEquipTool) | |