I want to make an easy to build on sword stand system for my killstreak sword game, where it is easy to add a new sword stand into the workspace and it functions like all the other ones.
My problem is that I’m not 100% sure how this will work, so any help is appreciated.
--Local script in starter player scripts
local rs = game:GetService("ReplicatedStorage")
local stands_module = require(rs:WaitForChild("modules"):WaitForChild("stands_module"))
local stands = stands_module.GetStands()
print(stands.ClassName)
local cs = game:GetService("CollectionService")
local TAG = "Stand"
local stands_module = {}
stands_module.GetStands = function ()
local stands = cs:GetTagged(TAG)
return stands
end
return stands_module
From what I got, you want to make a quick system that create x rocks based on how many swords you have instead of putting yourself the swords in the rock manually.
If that’s the case, first I have to understand if they are mesh parts, or models.
For mesh parts you could simply just change the obj value and move it back by an offset (manual or automatic you can decide) by using CFrame.
Instead if its a model the only solution I can think of now is to set the center of the model inside the stand and then move it by manually set offsets of position and rotation.
no sorry, i should have worded it better. basically the script finds all the stands that hold the swords, and all i would have to do is make a model with the stand tag and everything else is automated, i just don’t know if this is the best way or if i should just try something else
You are somewhat on the right track, utilising TagService is a good way to classify all sword stands in a game.
In this case it’d be better to use OOP (Object-Oriented Programming) approach to create and manage all of the sword stands in your game. It helps you to organise your code and handles all the swords logic behind it, making you only need to worry about different models and appearances of each sword stand you wish to add in your game. There are a plenty of Roblox OOP tutorials out there for you to check out: