and I meant the effect of having parts appear with the same material as the ground
What you can do is just get the color of the instance such as; Raycast.Instance.Color
And : Raycast.Instance.Material?
Yes you are correct but it would have to need the material and color.
Is it working for you? Because it doesnât seem to be working for me
local RaycastHitbox = require(workspace.RaycastHitboxV4)
local punch = script.Parent.Handle:FindFirstChild("Punch")
local swing = script.Parent.Handle:FindFirstChild("Swing")
local Damage = 10
local tool = script.Parent
local Hitbox = RaycastHitbox.new(tool)
wait()
local Character = tool.Parent
debounce = false
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {Character}
Params.FilterType = Enum.RaycastFilterType.Blacklist
Hitbox.RaycastParams = Params
Hitbox.OnHit:Connect(function(hit, humanoid)
print(hit.Name)
humanoid:TakeDamage(Damage)
punch:Play()
end)
function onActivated()
if debounce == false then
debounce = true
Hitbox:HitStart()
swing:Play()
wait(1)
Hitbox:HitStop()
debounce = false
end
end
script.Parent.Activated:Connect(onActivated)
Even then, I can still hurt myself.
local Character = tool.Parent
You need to define this variable when equipping, not at the top of the script since tools start in backpacks. Do a
print(Character)
to see what I mean. It will return the backpack instead of the actual character.
Example:
local Character
script.Parent.Equipped:Connect(function()
--- The tool has been parented to the character once equipped, so this is valid now
Character = tool.Parent
--- Set our params
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {Character}
Params.FilterType = Enum.RaycastFilterType.Blacklist
Hitbox.RaycastParams = Params
end)
Before you replied I seemed to have fixed the issue myself, I just had to initialize certain variables on equip, thanks tho!
How do you disable the red lines??? It is not working for me. This is my code:
local c = Player.Character
local Hitbox = RaycastingModule:Initialize(script.Parent, {c})
Hitbox.Visualizer = false
Sword.Activated:Connect(function()
Hitbox:HitStart()
wait(1)
Hitbox:HitStop()
end)
if Action == "Slash1" then
Hitbox.OnHit:Connect(function(hit, humanoid)
print(hit)
humanoid:TakeDamage(50)
Event:FireAllClients("1", hit)
end)
end
ignore the spacing lol
Update to V4 and follow the new syntax guidelines outlined in the main post. You are using old V3 methods.
I was using this module âin order to make a fake arm thatâs being tweened capable of dealing damage. I used the SetPoints method in order to set the points that I want the rays to cast from and this is what ended up happening:
https://gyazo.com/b243cda699601754b0e031379588d267
I originally thought that I made a mistake when setting the location of the points then I instanced some parts at those positions and I got this which is what I wanted.
https://gyazo.com/b937f6056ae72c9c011318465bc1e3f8
Iâm assuming this problem is to do with the Arms position and size being tweened but I canât figure out why itâs happening. What I wanted to happen was for the arm to tween in the forward direction and and the rays to move in the same direction as the arm.
My code is pretty much the same as the intermediate examples on the wiki apart from the following lines
local pointsTable = {Arm.CFrame:PointToWorldSpace(Vector3.new(0,0,-Arm.Size.Z/2)),Arm.CFrame:PointToWorldSpace(Vector3.new(0,Arm.Size.Y/2,-Arm.Size.Z/2)),Arm.CFrame:PointToWorldSpace(Vector3.new(0,-Arm.Size.Y/2,-Arm.Size.Z/2)),Arm.CFrame:PointToWorldSpace(Vector3.new(Arm.Size.X/2,0,-Arm.Size.Z/2)),Arm.CFrame:PointToWorldSpace(Vector3.new(-Arm.Size.X/2,0,-Arm.Size.Z/2))}
newHitbox:SetPoints(Arm, pointsTable)
local goal = {}
goal.Size = Arm.Size + Vector3.new(0,0,80)
goal.Position = Arm.CFrame:PointToWorldSpace(Vector3.new(0,0,-40))
local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,true)
local tween = TweenService:Create(Arm, tweenInfo, goal)
tween:Play()
Thanks for the help in advance
The module will automatically convert the points you give it to itâs object space, so you probably donât need to use :PointtoWorldSpace. It should work by just using Vectors only.
Example:
local pointsTable = {Vector3.new(0,0,-Arm.Size.Z/2), Vector3.new(0,Arm.Size.Y/2,-Arm.Size.Z/2), Vector3.new(0,-Arm.Size.Y/2,-Arm.Size.Z/2), Vector3.new(Arm.Size.X/2,0,-Arm.Size.Z/2), Vector3.new(-Arm.Size.X/2,0,-Arm.Size.Z/2)}
Let me know if it still doesnât solve your issue.
Worked perfectly thanks for the help
So exited to be finding this module at the perfect time. Iâm creating a combat system and this is exactly what I needed. Kudos!
Changing the mode from Default to PartMode doesnt work
( well it changed just doesnt register), is it because part mode used hit instead of the humanoid part?
RaycastModule always returns the part that it hit, irrespective if they have a humanoid root part or not. PartMode should return the parts hit, but will not return parts it has already hit. What is your code that doesnât work?
I fixed it, but this is the most amazing module ive ever used.
Is there a way to turn off the prints on creating a new hit box? I know the debug log property, but that only works after creating a new one
Lmao I just realized I can edit the module itself, never mind. (You know itâs good when the user forgets it isnât a default Roblox service)
Well I found the property anyway, but this is awesome. Thanks