Help with a node-based system

Me and a friend are working on a game based around Survival Roleplay, and we’re trying to make a node-based looting system where it has various categories (Military weapons, Military medical items, Civilian food, etc.) and what we have in mind is that a script chooses a random item model from a folder and it’ll move the selected model for the item to the node, but that’s exactly what we are having problems with. If someone could either help us with moving the entire model to the position of the node, or help us with a better looting system in general, we’d both appreciate it.

Thank you.

1 Like

Are the models welded? If they are you can just change the CFrame of the primarypart to the node

2 Likes

It should just be a matter of getting the item and then CFraming it like this:

local items = game.ReplicatedStorage:WaitForChild("Items"):GetChildren()

local randomItem = items[math.random(1,#items)]:Clone()
randomItem.Parent = workspace
randomItem.Handle.CFrame = CFrame.new(node.Position) -- or randomItem:SetPrimaryPartCFrame(CFrame.new(node.Position)) for models (Make Sure it has a primarypart)

This could work, but, what we have in mind is not exactly moving a tool to the node, what we have in mind is moving a model with a clickdetector hitbox around it that when you click it, it moves a tool into your inventory and removes the original model.

oh all you would need to do is create a new part like this local clickpart = Instance.new("Part"), and then make a click detector in the part local clicker = Instance.new("ClickDetector", clickpart) and then maybe set the cframe of the part to the random item like so:

clickpart.Anchored = True
clickpart.CFrame = CFrame.new(randomItem.Handle.CFrame)

and after that you could just do this to check if the clicker has been clicked:

Code
clicker.MouseClick:connect(function(player)
       local newItem = game.ReplicatedStorage:FindFirstChild(randomItem.Name)
       newItem.Parent = player.Backpack
       clickpart:Destroy()
       randomItem:Destroy()
end)

Okay, I’ll take this into consideration but what I needed help with is moving the actual model from a folder to a node.
Example: Folder in ReplicatedStorage called Loot has multiple categories inside it. (MilitaryWeapons, MilitaryFood, CivilianWeapons, etc.) Those folders have ServerModels or WorldModels (not actual tools, only a model that would show serverside) A script would have a table containing the different types of loot
Example of the table:
local militaryWeapons = {M4A1, AK74, AKMSN}
local civilianFood = {Skittles, ChocolateBar, Soda, Water|
And the script would choose one of the items in the categories and move it to a specific node matching the name of the table.

If you cannot help us with this, we’d love it if you simply showed us how to move a Model from a folder to a node. Thanks.