Here is the preview of ShapecastHitbox and the new plugin:
The plugin allows you create and modify shapecasts.
So rather spamming a few hundred attachments to get the same shapes, you can just modify the shapes of your hitbox however you like.
Here is the preview of ShapecastHitbox and the new plugin:
The plugin allows you create and modify shapecasts.
So rather spamming a few hundred attachments to get the same shapes, you can just modify the shapes of your hitbox however you like.
absolutely! i love this plugin and will always be my go when it comes to melee weapons. your work is deeply appreciated!
Is there a estimated release date?
I was just about to ask the same thing!
Yes, there are no good shapecast utility modules that I know of, a sequel to Raycast Hitbox 4.0 for shapecasts would undoubtedly be amazing
Shouldn’t take longer than two weeks! Probably @ me here again if I miss the deadline, haha! Currently, the module is complete but I am testing it in two full scale production games to ensure that nothing is wrong before I commit to a public release.
And also helps me to give me a window for feedback from testers to see if the API needs to be improved.
EDIT:
For those who wants to try it out earlier with us:
Here’s the Github link to the module or Wally if you are using Rojo. Be aware that this is very early versions that is currently undergoing tests with our teams.
There are no documentations just yet, but you can take a look at ShapecastHitbox/Types.luau to get a general feel of the API. For those who are new to Github, you can just download the file and copy paste the code into your codebase.
I’m having an issue where when I start a hitbox, the first set of lines (at least how it appears in the visualiser) doesn’t seem to register a hit, but the other lines work fine.
In the “Attachments” module script in the solvers folder on line 15, shouldn’t
local origin: Vector3 = point.Instances[1].WorldPosition
actually be
local origin: Vector3 = point.LastPosition
?
Update 1:
I’m trying to use RaycastHitboxV4 in ServerScriptService but every example I’ve seen has been a script in the workspace.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local signals = ReplicatedStorage.Signals
local remotes = signals.Remotes
local raycastHitbox = require(script.RaycastHitboxV4)
local playerCooldowns = {}
local humanoidsHit = {}
local cooldown = 0.75--will be changed because each tool has different cooldowns
local damage = 25
local Attack = {}
Attack.Init = function()
remotes.ToServer.OnServerEvent:Connect(function(player,signal,toolName)
local char = player.Character
local hum = char.Humanoid
if signal == "Trigger" then
local tool = char:FindFirstChild(toolName)
if tool then
if (playerCooldowns[player] and tick() - playerCooldowns[player] >= cooldown) or not playerCooldowns[player] then
playerCooldowns[player] = tick()
else
return
end
print("Successfully created")
local hitbox = raycastHitbox.new(tool.Hitbox)
local hitC = hitbox.OnHit:Connect(function(hit,humanoid)
print(hit,humanoid)
if humanoid == hum then return end
humanoid:TakeDamage(damage)
end)
print("Started")
hitbox:HitStart()
task.wait(cooldown)
hitbox:HitStop()
end
end
end)
end
return Attack
When I click and attempt to fire this event to the server nothing happens but started and successfully created both print so I think its something wrong with how I’m using RaycastHitbox.
Can you only put this module and any script requiring it inside of a tool?
Update 2:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local signals = ReplicatedStorage.Signals
local remotes = signals.Remotes
local raycastHitbox = require(script.RaycastHitboxV4)
local playerHitboxes = {}
local playerConnections = {}
local playerCooldowns = {}
local humanoidsHit = {}
local cooldown = 0.75--will be changed because each tool has different cooldowns
local damage = 25
local Attack = {}
Attack.Init = function()
Players.PlayerAdded:Connect(function(plr)
local hitbox
plr.CharacterAdded:Connect(function(char)
local hum = char.Humanoid
char.ChildAdded:Connect(function(tool)
if tool:IsA("Tool") and tool:FindFirstChild("Hitbox") then
if not hitbox then hitbox = raycastHitbox.new(tool.Hitbox) end
local c1 = tool.Activated:Connect(function()
hitbox:HitStart()
task.wait(cooldown)
if hitbox then hitbox:HitStop() end
end)
local c2 = hitbox.OnHit:Connect(function(hit,humanoid)
if humanoid == hum then return end
humanoid:TakeDamage(damage)
end)
table.insert(playerConnections,c1)
table.insert(playerConnections,c2)
end
end)
char.ChildRemoved:Connect(function(tool)
if tool:IsA("Tool") and tool:FindFirstChild("Hitbox") then
for i,comp in ipairs(playerConnections) do
comp:Disconnect()
comp = nil
end
if hitbox then hitbox:Destroy() hitbox = nil end
end
end)
end)
end)
end
return Attack
So basically I removed firing to the server and made detection on the server.
There are multiple issues but my main one is that I can’t disconnect the OnHit event and I remember Swordphin saying he created something for the intended use of not disconnecting something so I’m not sure if I’m going in the right direction or not.
Update 3:
Ok all the fixes above I fixed but now I am back at bottom.
My current problem is that whenever I try to create a RaycastHitbox, the debug lines don’t show, the hitbox can’t be recognized in the code, and the hit detection doesn’t work.
I get random errors as well such as:
ServerStorage.Server.Attack.Melee:32: attempt to call missing method 'HitStop' of table
for _: number, point: Point in ipairs(ActiveHitboxes[i].HitboxRaycastPoints) do -- In the hitboxcaster
It mostly says HitStop and HitStart are missing methods.
It worked a while ago but I don’t know what I did to make it not work.
I checked through my past history but even in those past sessions when it did work, its not working anymore.
I don’t know what magical thing happened for this to change.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local signals = ReplicatedStorage.Signals
local unreliables = signals.Unreliables
local raycastHitbox = require(script.RaycastHitboxV4)
local infoSignaler = require(script.Parent.InfoSignaler)
local playerHitboxes = {}
local function reset(connections)
for _,comp in ipairs(connections) do
comp:Disconnect()
end
table.clear(connections)
return connections
end
local Melee = {}
Melee.Start = function(plr,tool,info,playerParams,plrConnections)
local char = plr.Character or plr.CharacterAdded:Wait()
local root = char.HumanoidRootPart
local c1,c2
playerHitboxes[plr] = raycastHitbox.new(tool.Hitbox)
playerHitboxes[plr].RaycastParams = playerParams
c1 = tool.Activated:Connect(function()
playerHitboxes[plr]:HitStart()
task.wait(info.Cooldown)
playerHitboxes[plr]:HitStop()
end)
c2 = playerHitboxes[plr].OnHit:Connect(function(hit,humanoid)
local targetChar = hit.Parent
local targetRoot = targetChar.HumanoidRootPart
for _,player in Players:GetPlayers() do
local playerChar = player.Character or player.CharacterAdded:Wait()
local playerRoot = playerChar.HumanoidRootPart
if (playerRoot.Position - tool.Hitbox.Position).Magnitude < 5e2 then
local returnedInfo = infoSignaler[tool.Name](tool)
unreliables.ToClient:FireClient(player,tool.Name.."FX",returnedInfo)
end
end
targetRoot.AssemblyLinearVelocity = ((targetRoot.Position - root.Position) * 25) + Vector3.new(0,50,0)
humanoid:TakeDamage(info.Damage)
end)
table.insert(plrConnections,c1)
table.insert(plrConnections,c2)
return plrConnections
end
Melee.End = function(plr,plrConnections)
if playerHitboxes[plr] then playerHitboxes[plr]:Destroy() table.clear(playerHitboxes[plr]) playerHitboxes[plr] = nil end
local resetConnections = reset(plrConnections)
return resetConnections
end
return Melee
I have another main module called attack above this one but it just starts and ends these when equipping and unequipping tools.
I also tried moving the playerHitboxes table to the parent attack module but it did the same thing.
Found an interesting bug(?).
This module only works on server-sided Scripts
with the Legacy RunContext
. The Server RunContext
returns nil
when performing RaycastHitbox.new()
.
I haven’t tested it with client-sided scripts, so I can’t report on that.
Edit: I realised you can’t create new hitboxes if the part isn’t parented to workspace. Since “Server” RunContext scripts run regardless of the container, that’s why I was getting my error.
Legends says you’re still doing awesome work on it
those legends would be very right
I dont know whats going on but everytime I try to return the new hitbox i keep getting
"attempt to call missing method ‘HitStart’ of table "
My code here is this:
local function PreloadComponents(player)
local animator = player.Character:WaitForChild(“Humanoid”):WaitForChild(“Animator”)
–preLoadAnims
preloaded_Animations[“M1”] = animator:LoadAnimation(M1)
preloaded_Animations[“M2”] = animator:LoadAnimation(M2)
preloaded_Animations[“M3”] = animator:LoadAnimation(M3)
preloaded_Animations[“M4”] = animator:LoadAnimation(M4)
preloaded_Animations[“SpecialAttack1”] = animator:LoadAnimation(SpecialAttack1)
--Get HitBox
local KnifeModel = player.Character.Knife
local HitBoxPart = KnifeModel["Knife(model)"].HitBoxKnife
local newHitBox = RayCastHitBox.new(HitBoxPart)
return newHitBox
end
then after that I call it on a button press:
local moveSets = {
[“I”] = {
Action = function(Humanoid) local Utility = replicatedStorage["Combat System"].Utility local newHitBox = Utility:Invoke() newHitBox:HitStart()
but I keep on getting this error:
ReplicatedStorage.Combat System.CombatEvents:89: attempt to call missing method ‘HitStart’ of table - Studio
whenever I debug it and print newHitBox I get this:
22:28:42.637 ▼ {
[“DebugLog”] = true,
[“DetectionMode”] = 1,
[“HitboxActive”] = false,
[“HitboxHitList”] = {},
[“HitboxObject”] = HitBoxKnife,
[“HitboxPendingRemoval”] = false,
[“HitboxRaycastPoints”] = {…},
[“HitboxStopTime”] = 0,
[“OnHit”] = ▼ {
[“_handlerListHead”] = false,
[“_signalType”] = 2
},
[“OnUpdate”] = ▼ {
[“_handlerListHead”] = false,
[“_signalType”] = 2
},
[“SignalType”] = 2,
[“Tag”] = “_RaycastHitboxV4Managed”,
[“Visualizer”] = true
} - Client - CombatEvents:89
Whats going on and why does it do this? I don’t get it…
You missed the deadline lol (jk)
I got many hours of headache until i realize I cant add 2 different hitbox to the same basepart. Pls change that.
RaycastHitbox is no longer being maintained. This issue is fixed in my new module though
Has relatively the same APIs.
Would you say it’s better to use v4.01 if I am starting right now? Or should I use the new API? And will it be easy to switch?
Hey there, there seems to be some error with the module script.
ServerScriptService.RaycastHitboxV4.HitboxCaster:55: attempt to index nil with ‘HitboxActive’ - Server - HitboxCaster:55
20:57:49.882 Stack Begin - Studio
20:57:49.882 Script ‘ServerScriptService.RaycastHitboxV4.HitboxCaster’, Line 55 - function HitStart - Studio - HitboxCaster:55
20:57:49.882 Script ‘Players.DEV_N1GHTM4RE.PlayerGui.sword.server’, Line 45 - Studio - server:45
20:57:49.882 Stack End -
Any help will be amazing!
Hi! I’ve been using your module and made a local script that fires a remote to the server, telling it to damage a player. however the print statement in the local script fires once but in the server script it fires twice. I don’t know why it is doing that. Localscript:
local HitboxConnection = nil
HitboxConnection = Hitbox.OnHit:Connect(function(hit, humanoid)
if humanoid.Parent ~= char then
print("hITcLIENT")
HitboxConnection:Disconnect()
attackRemote:FireServer(hit, humanoid, Damage)
end
end)
Server:
attackRemote.OnServerEvent:Connect(function(player, hit, humanoid, damage)
local char = player.Character
local enemy = humanoid.Parent
if char ~= enemy then
print("HitServer")
end
end)