What would be the most optimistic and better way to make a sword, because currently I’m using just a normal local script that sends remote vents every touch it does to a server script, so basically I’m using just a normal touched function. Is there a better way to make a sword, by not using the is function as it seems quite buggy sometimes?
If you don’t want to make an entire script by hand, simply use Roblox’s ClassicSword model and take the scripts from there.
There are a lot of “better” ways to make a Sword, a A more optimized way just means that its quick, efficient, and doesn’t take up as much memory, It is recommended to do the Special Effects like Fire, or Swinging on the Client, However on the Server, you would do the Calculations and Events.
For the Attacks, you wouldn;t use Touched
, as it uses more rescource’s when something touches something, Instead I would Recommend you Raycast (with either Ray.new()
or workspace:Raycast()
) as that is much more Accurate and Efficient for what you are trying to do, However, never do it from the Sword itself, that’s how you make your Weapons suck, Its better to do it from the Character.
Here is a small Example of a Raycast
local Range = 10
local Result = workspace:RayCast(HumanoidRootPart.Position, HumanoidRootPart.CFrame.LookVector * Range)
if Result then -- If your Raycast Succeeded
-- within here, you will check if you hit a Part within a model that has a Humanoid.
These are a couple of things that may assist you, as I’m not here to teach people how to code stuff, I’m just here to give you idea’s on your project.
Also, Please don’t listen to @Falcon_Aviator as that is a Horrible idea, I recommend only Reading the code, get an Idea of what it does and learn off of it, rather than just completely taking the code, If you do this, you will have no Knowledge about the code within, so if you wanted to make fixes, it would be almost impossible unless you have the proper knowledge (I’m pretty sure you do)
I used clientcast in the end, is that any good?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.