i am wanting to make a custom scripted tool system that doesnt use Tools from roblox. but i don’t know where to begin. i have search up on the dev forum, but i canot find a full on tutorial or anything explaining how.
can someone perhaps point me to where there is a tutorial, or make one here? or if not a full on tutorial, a short explanation of how ur tool system is scripted or how it works and give me pointers on what to learn, or what to do, et. thanks
The simplest solution is to use Motor6Ds to attach the tools to the player and use the User Input Service to give them controls. I definitely recommend looking into the both of these.
A lot regarding programming the tool is just standard scripting with remotes, doesn’t differ that much or at all when it comes to a “toolless tool”. Most of the pain points will be organising the equip logic. Equip logic too is relatively trivial since you can change equip/unequip code to be functions activated by the client and have the server render the tool on the character’s hand.
Alrught so first you’d need to use UserInputService to detect when the player equips/disequips a tool. Then you need to use RunService’s RenderStepped to constantly update the object’s CFrame to the position like the right arm of the player + Vector3.new(X,Y,Z) when it’s equipped. Then you need to replicate the object position to the server.
Basically :
UserInputService - Get input
RunService - Set object’s position or CFrame
RemoteEvents – Replicate to server (If you skip this step the code will only run on YOUR computer, so everyone elss will not see the object.)
okay, so i think i made a decent equip and unequip logic system thing for the tool system, do you think this is okay or should i change anything/ redo anything ? it is in a localscript
local UserInputService = game:GetService("UserInputService")
local Keybinds = {
Main = Enum.KeyCode.E,
Seconday = Enum.KeyCode.R
}
local CurrentWeapon = "none"
local IncomingWeapon = "none"
local function Equip(weaponType_)
IncomingWeapon = weaponType_
if CurrentWeapon == IncomingWeapon then
CurrentWeapon = "none"
IncomingWeapon = "none"
else
CurrentWeapon = IncomingWeapon
IncomingWeapon = "none"
end
print(CurrentWeapon)
end
UserInputService.InputBegan:Connect(function(inputObject_, gameProcessedEvent_)
if gameProcessedEvent_ then
return
end
local KeyCode = inputObject_.KeyCode
if KeyCode == Keybinds.Main then
Equip("Main")
elseif KeyCode == Keybinds.Seconday then
Equip("Secondary")
end
end)
i modeled it after roblox’s where if you click on a new tool while having one already, it auto unequips that and equips the other one, and if you try to equip the same tool, it unequips.
So i heard about motor6ds when i was researching how to animate a tool, but i don’t really know what else it is for. could you elaborate on how i could use that for my tool system? because i was initially thinking on using Accessories because of the welding it internally does with its attachgments, but i will reconsider using anything else if it is more correct.
i dont think i need to constantly update the cframe of the tool. we can always use welds, or in my intended case, accesories have an internal “weld” by using attachments to the PLayer. but i am also considering Motor6d, and u might too if u might considering making a tool system as well.
It depends on what you want to do with the animations! If you don’t plan to rotate the tool at all within it’s usage, then accessories is just fine; however, if you wish to treat the tool as it’s own joint that you can freely manipulate in animations, then a motor6d is the way to go.