Use three backticks followed by the word ‘lua’. Then paste your code right after. You can then end it off with an additional three backticks at the end of the script. This should format the code for readability.
It’s a little hard to follow without having a reference on how you are setting up SetPoints but from what I’ve hopefully gathered trying to piece the puzzles together is that
SetPoints is not accurately putting the points where they need to be.
Equipping/unequipping will reposition the points in space with progressively worst results
What is [ZERO, ZERO] referring to exactly? Is this a Vector2 point? I’m not exactly experienced with tools (I haven’t used them in over 7 years) but if you have a simple repro place that you can DM me that demonstrates the issue, I can try to diagnose it for you. From the experiences you highlighted, it may also be possible that RaycastModule has a bug with Setpoints specifically.
I would be willing to send you a copy of my place, but where can I send you a copy privately, if possible?
If not, then I’ll do it publicly, I’m not that good at coding anyway.
EDIT: “ZERO, ZERO” or more realistically “ZERO, ZERO?, ZERO” isn’t a confirmed coordinate like 0,0,0. It was just a shorthand for me explaining where I spawned (aka ZERO,?,ZERO ~> my spawnpoint without a spawn location) in the game seemingly having the minimal amount of drift. The actual numbers of the position in 3d space is unknown. Like I spawn in, activate it, and it has less drift than if I walk somewhere away from my spawn then activate it. It’s kind of like “X marks the spot” but flipped on its head.
Hey Swordphin, I managed to get past the issue that you mentioned earlier. Thanks for the quick responses.
I’ve actually got another issue, and it has to do with hitbox detection when NPCs in my game attack players. Since the hitbox is dependent on the position of swords(or a part hitbox welded to the NPC’s hands, in this case), I figured that it would be a good idea to play only an NPC’s attack animations on the server while the rest of it’s animations are played client-side.
While this made your hit detection system work perfectly(it was being called on the server), playing animations on the server came with a huge issue. After a short period of time, most NPCs would freeze on every client(I know for a fact that they froze on each client rather than the server. The server was running fine and was not experiencing any lag). They would just run in place, sometimes floating in the air. I narrowed the problem down to the server-side animations. As soon as I removed them, the issue stopped.
So the dilemma I’m facing is the fact that this hit detection system is essentially tied to the swing animation that’s played. One solution I thought of was going with the usual client-sided NPC animations and detecting damage with your module on each client(each player will detect if the NPC hits them). I initially wanted to have the NPC hit detection be completely server-side, but this seems like the only solution.
I noticed that you use NPCs in your game. Is this how you solve this issue, or do you do things differently?
If this is going to be any serious long term game project, please do not make clients listen if they get hit. This is a big security flaw and you will have massive headaches later. I speak from experience.
I would try to find the root cause of what freezes your NPCs (unfortunately i do not know your game systems well enough to suggest any solutions) instead of relying on workarounds that would ultimately risk exploitations.
For how I do it, all my enemy hit detection are server-sided so they aren’t anything special. Visual effects (like particles) are drawn on client side afterwards.
Hey, I love your hitbox module it’s awesome! Easily one of the best things on here.
I see to be having a problem with it though, for some reason when players are teleported the hitbox itself will skew entirely and not be moved with the player.
This happens when the HumanoidRootPart’s position or orientation is changed in any way, and results in the hitbox staying where it was before the teleportation and being sort of welded to the player and stuck in that position.
If possible, can you show any video footage of it happening? If the hitbox is created on the server side, I suspect it may be a Roblox replication bug that is out of the scope of the module (though will need to check to confirm if it is). The only fix that I know of if this is your case is to move the hitbox logic to the client.
Also let me know if you are using attachments and/or setpoints.
My computer is too garbage to record video but i can provide examples.
The hitbox is created on the server, and attachments are used for the damage points.
Lets say for example I am using a tool with this implemented, a basic sword. If I set the CFrame of the HumanoidRootPart to turn the charactera certain direction, the hitbox will now be offset at the angle I had set for the player, only in the opposite direction.
Another example is if i set the CFrame of the root to a different position to teleport the character, the hitbox will now be offset the distance that teleport was from where the player was originally.
i made some code to make the attachments on the weps u cn put this in the cmd line to use-
local part = game.Workspace.Tool.Hitbox;
local attachcount = math.floor( part.Size.Y);
for i= part.Position.Y - part.Size.Y/2, part.Position.Y + part.Size.Y/2,0.5 do
local currattach = Instance.new("Attachment");
currattach.Name = "DmgPoint";
currattach.Parent = part;
currattach.WorldPosition = Vector3.new(currattach.WorldPosition.X,i,currattach.WorldPosition.Z);
end
So even if I were to have hundreds of npcs using a raycast hitbox, the performance would be better than Touched? Is touched fired even if you do not connect to it in the backend?
You can see that the clients perspective shows a delay (probably because the raycasts are being ran serverside). Is there anyway I can remedy this AND keep the rays serversided?
Unfortunately, this is called latency. The time it takes for the client to send information to the server and then back requires distance, and distance requires time. Roblox replication runs much slower and less frequently than the client’s FPS, meaning there will always be inaccuracy issues compared to making it client-sided, so regardless of what remedies you attempt to make it smoother for the client, it will never be a replacement for pure client-side implementation.
An example of server latency can be seen here in a previous post:
The server will always see changes much, much later than what clients see. This is also why competitive FPS games have trouble in solving their “peeker’s advantage”, as the client user always sees the enemy before the enemy can see them. This is not a Roblox problem, this is just how networking goes.
Ran into a small issue when using the module; when a tool DmgPoint comes across multiple DmgPoints packed together on a humanoid, it deals damage according to the amount of DmgPoints hit.
I was just wondering if the fix would be to put a debounce in the sword script itself?
Thanks
Can you clarify this part? Do you have PartMode turned on? The module ignores any successive DmgPoint collisions once 1 DmgPoint has confirmed a hit. Are you sure the amount of hits are 100% equal to the amount of DmgPoints? If you call HitStart/HitStop rapidly, this will also reset the collision logic, allowing DmgPoints to start listening for hits again.
A debounce would fix it, but technically shouldn’t be needed since the module does that for you (well, filters the other DmgPoints at least)
Thank you for your reply,
I checked and the sword has partMode set to true (I was using the test.rblx with the dummies). It seems like it’s dealing damage proportionate to the more condensed parts of a character (usually 40+ dmg when across the shoulders and 20+ when slashing a single shoulder)
Yeah if you want the sword to damage once, try setting partmode off or false. PartMode is designed to replicate the normal touched behaviour. What you are seeing is intended functionality as the roblox sword also damages that many times.
Hi there, sorry for the late reply, did not have time to be on the DevForum but I’m back again. This seems to be the normal behaviour of the linkedswords created by Roblox (I merely ported the damage logic to them and did not edit any other functionality).
The 20+ damage is due to the initial 10 damage hitting a part (upon starting a swing), and then another 10 damage once the sword comes back up, similar to how Touched works. Multiply this damage with the amount of parts in the humanoid (and where the sword intercepted) and you got yourself the logic you witnessed.
If you require precise damage (such as only 10 damage through the entire swing), you will need to modify the sword script a little, such as removing :HitStop() and only using HitStop() after the swing is completed.
I may make another sword example that doesn’t use LinkedSwords since I do feel it’s not a good representation of the module.
Teaser for Version 3.31 (coming soon)
This minor update is targeted towards users looking to use this module for mesh deformation. I am currently testing performance and will update once I can confirm my production game runs without issue with this update. This will be exclusive to SetPoints as attachments do not work with mesh deformation bones (as of this post).
The module already damages multiple targets at once. It just cannot hit the same target(s) you hit again until you hitstop. Do you mean hitting the same target again?