#Model-Based Tool System

1 messages · Page 1 of 1 (latest)

violet plover
#

Because I don't want the weapon system to work as regular tools, aka don't appear as a proper tool in the backpack, etc, I'm forced to make my own weapon system.

Is there any efficient way, or plan I should go by? Right now, my current plan is to set up inputs on the client, and the server can change the currentWeapon variable into the weapon. From then on, animations, hitboxes and such can be handled on the client whenever currentWeapon is not nil and a few under checks, and the rest can be handled on the server.

I'm going for something modular, so you can give tools by :Give() on a module through a WeaponManager on the server.

My main issue is the clientside and handling things so seperated like this, alongside this being harder to work with because it is not a tool, just a model.

If any of you have done something like this, can you share how you did it? Specifically how you handled client input and such in a way that's easily trackable and consistent, alongside optimized? Is it worth it? Are there better solutions to my problems?

#

If you still don't get what I mean: A model that works as a tool without a tool instance.

#

Doesn't get put into the backpack, etc. Hard to work with but better sometimes. Incase you wanna have multi tool equipping. Item in one hand, weapon in other.

#

Or for other relevant things.

thick ledge
#

weld the tool with the hand

#

when tool is equipped, store it in your script like
Tool[Player] = Tool:Clone

#

weld the tool model together, with a primary part on where to hold

#

and to hold tool,

Weld.Part0 = Tool[Player].PrimaryPart
Weld.Part1 = Character.RightHand```
#

i hope i could help

stuck escarp
violet plover
# stuck escarp yeah its fine but you have to do everything yourself incl hold animations and pu...

its more so properly organizing the scripts, and using a modular solution
I don't like having scripts inside the characters, or at least, not a lot. i like stuff being optimized
i'm just wondering if my solution of, having a clientside script (in my case, a modulescript thats required for the player specifically for handling that kind of input) specifically for handling the inputs of the weapons whenever a variable is set would work through fireclient and such.
but i don't see a huge problem, its just that i need to have multiple input handlers if i wanna have multi tools, like weapon in one, item in another, incase i wanna have a model for the item too
actually, a good example would be: holding a weapon and using an ability. you need to properly manage inputs for both and idk how much that impacts performance or how optimized/good that is, even though it only works if the variable is set with proper data.

for the oop weapon system i made an oop class basically recreating the methods of a regular tool with goodsignal and such (.equipped, .activated, .unequipped) and then made a weaponclass, which properly handles logic for the weapon if the name of the weapon is specified. then it grabs the data from a config script, if it exists

then a weapon manager which gives and removes said weapons, and that's all
maybe i'm overthinking it, because i am a huge overthinker and i often overlook simple/already correct solutions

violet plover
thick ledge
violet plover
#

im wondering if i should create a ClientTool variable inside of the weaponinstance on the client, so that the client can have proper tool functionality access too
since if im correct the client wouldn't properly process goodsignal events being fired from the server, even if the table is passed

stuck escarp
violet plover
#

gahhh itd be so much easier if i could get the client and the server to use the same exact signals, so that some parts of the code would be easier/more natural to write, aka it would feel like youre working with actual tools more so

stuck escarp
violet plover
stuck escarp
violet plover
#

buffers and such i wanna leave for last since that just hurts my mind

violet plover
#

this would be incredibly useful but in my understanding it wouldnt be possible if it was server required

stuck escarp
#

they do not share state

#

like if you require a module from client and server then each has a different local copy of the module

#

so changes in one copy will not reflect in another

violet plover
#

damn it

#

would have been nice

#

cause then i could of had the client detect signals being fired on the server

#

or vice versa so the tool system wouldnt of been as crude

#

alright i was curious, ill try cooking something up once i can get to it

#

thank you though, i was a bit stuck on how i would go about making it since i wanna better my coding skills and go for the best approaches

stuck escarp
#

roblox is fairly convenient, but not that convenient hehe

violet plover
#

yeah

#

i wonder how tools solve this, because both the server and client have .activated, .equipped and .unequipped and they are synced

#

and you cant recreate that

#

which is odd

stuck escarp
stuck escarp
# violet plover and you cant recreate that

you can recreate it with your own code if you really want to, but i mean if you don't want to deal with all those issues, it is often far simpler/easier/better to resort to existing tools and making them do what you want. why re-invent the wheel?

violet plover
#

yeah im literally doing this so they dont act/appear as an actual tool instance

#

i would use tools

#

its just that

stuck escarp
#

and if you're wondering about exploiters, yeah they can mess with their client, but you should be checking everything on the server regardless, so that is not a problem.

violet plover
#

yes but that requires you to make your own inventory system which is incredibly tedious if you wanna have swapping and such (tried to make JUST a hot bar before with swapping, it was really hard)
plus i specifically dont want JUST the weapons to appear inside the inventory

#

and for some games id probably want the backpack ui to remain the same

#

as yk roblox

#

i can use this backpack solution for another game of mine since i have a custom weapon selection system set in place, which doesn't have dragging, swapping and a proper inventory, so it wasn't too hard to set up
but yea keeping the default ui, or making my own with a proper inventory and swapping is tough, especially because there is no documentation or guide on it

#

yk, swapping the weapons in the table properly and switching the ui, storing all the items in the inventory, all that is just a lot

stuck escarp
violet plover
#

well for the default ui i could most likely find a public release of the roblox backpack ui and mod it to ignore tools with some tags, but custom ui will bea bit tough

stuck escarp
violet plover
#

no not really

#

i just expected a bit more documentation on it since i dont even have any idea on how to get started on the actual inventory

#

well backpack

#

more so

stuck escarp
#

if a tutorial doesn't exist, well... yea no one said it was easy KEKW

violet plover
#

there is no tutorial

#

ive tried to do something like this before so i know

#

i looked through the entirety of devforum

stuck escarp
#

scripting is as much art as it is engineering.

violet plover
#

i already got yk

#

hotbar slot swapping

#

i dont know how id make the actual inventory part though

#

so you can drag stuff in and out and itll sort itself properly

#

swapping is the hardest part id say

stuck escarp
violet plover
#

yeah well thats just for the hotbar

stuck escarp
#

just break it down

#

all things are simple when you make it very simple things

violet plover
#

well ill try making a rough sketch/drawing of how i think itd work

stuck escarp
#

you could treat it like an animation

violet plover
#

its rough when u dont know where to start

stuck escarp
violet plover
#

youd obviously have 2 seperate tables for the inventory and hotbar but swapping items between them is yeahh
maybe ill rewrite the hotbar system to make it easier for myself

#

into an oop class or something, so each slot can just have the proper tool, key and index assigned to it, then you could edit that however u want

stuck escarp
violet plover
stuck escarp
#

but it is one part of it

#

i've made a bunch of inventory systems before so i'm familiar with a number of different ways of doing it

violet plover
storm crystalBOT
#

studio** You are now Level 9! **studio

violet plover
#

ur statement

stuck escarp
#

i don't entirely like how roblox does it but i don't entirely hate it either given their design constraints

#

it gets the job done 👍

violet plover
#

well i think the most obvious part is that yk

#

you would have the inventory in slots

#

like frameslots

#

with whatever u want, in an ui list

#

or create your own custom ui list position thing so you can actually swap it around

stuck escarp
violet plover
#

i mean yeah

stuck escarp
violet plover
#

youd have slots

#

yes

#

you asked most obvious thats where youd start

stuck escarp
violet plover
#

to hold tools

#

duh

stuck escarp
#

make one, and iterate from there.

#

when you start an animation, do you start with mid-frames between keyframes? no. you almost dont even start with full body keyframes. you start with a very small select few things that you want to achieve, and maybe you done an animation like that before and you know what to do, but if you haven't, obviously if you're trying to make a punch animation you start with arm move and face forward (impact frame), and you kind-of work backwards from there. code is no different.

violet plover
#

i mean yeah you obviously start from the most simple things

#

when u get to the complicated part

#

is where it kicks off

#

u might not have an exact idea

stuck escarp
stuck escarp
violet plover
#

ill try

#

ill most likely use oop for some parts

#

to make it simpler for myself

#

so i can actually assign data, tools and such to specific slots

#

so then swapping slots would be a tad bit easier i think

stuck escarp
#

and often what you end up doing is taking your first working example and then splitting it into smaller and more oop-ified parts

#

talking isn't iterating. have at it! i belief in you cool_finger_guns

violet plover
#

as in im already planning

#

how it would work

#

to make it easier for myself to make this

#

so that i dont get a brain aneurysm from stressing on one thing which could of been avoided by not having the proper data assigned to something or not doing it another way

#

like if i were to add item rarity for example i wouldnt stress as much, because i could just add it to the slot and color the slots if there is a rarity set

stuck escarp
#

your first iteration is gonna be trash and that's okay. that's normal.

stuck escarp
#

Analysis paralysis (or paralysis by analysis) describes an individual or group process where overanalyzing or overthinking a situation can cause forward motion or decision-making to become "paralyzed", meaning that no solution or course of action is decided upon within a natural time frame. A situation may be deemed too complicated and a decisio...

#

Analysis paralysis is when the fear of either making an error or forgoing a superior solution outweighs the realistic expectation or potential value of success in a decision made in a timely manner.

violet plover
#

although for abilities ill still have to do what i originally intended to do