Can RaycastHitboxV4 only be used when its scripts are under tools?

I’m trying to use RaycastHitboxV4 in ServerScriptService but every example I’ve seen has been a script in the workspace.

Server Code
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.

I am also thinking of disconnecting the OnHit but I dont even know if its possible.

2 Likes

I disabled some ragdoll script I had because I have a game where it has ragdoll physics through runtime and it showed the red lines. Is there no other way to use a ragdoll with RaycastHitbox?

Edit: I misread your post mb be he uses a main server script im not sure if you can implement your idea

Alright, ill check it out and see if it works thanks.

He does not use tools though so your going to have to work your way around that

1 Like

Sadly I can’t really use a ragdoll physics system during runtime with RaycastHitboxV4 but I fixed everything regarding RaycastHitbox.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.