ive been stuck doing this script for 2 hours, i cannot figure out, HOW TO GET IT TO DETECT IF IT HITS A PART FROM THE FOLDER:sob:
hitter.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
local wall = game.Workspace:WaitForChild("wall")
local partsss = wall:FindFirstChild("Part")
local wallhit = hit.Parent:FindFirstChild("partsss")
if hit.parent == partsss and hit.Parent.Name ~= plr.Name and not hitOnce then
print(partsss)
print(hit)
hitOnce = true
hitter.BrickColor = BrickColor.Green()
```
part.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild(āHumanoidā)
local wall = game.Workspace:WaitForChild(āwallā)
local isPartOfWall = false
for _, part in wall:GetChildren() do
if hit.Parent == part then
isPartOfWall = true
break
end
end
if isPartOfWall and hit.Parent.Name ~= plr.Name and not hitOnce then
print(hit.Parent)
print(hit)
hitOnce = true
part.BrickColor = BrickColor.Green()
elseif hum and hit.Parent.Name ~= plr.Name and not hitOnce then
hum:TakeDamage(damage)
print(hit.Parent)
hitOnce = true
part.BrickColor = BrickColor.Green()
end
local hum = hit.Parent:FindFirstChild("Humanoid")
local wall = game.Workspace:WaitForChild("wall")
local partsss = wall:IsDescendantOf(wall)
local wallhit = hit.Parent:FindFirstChild("partsss")
if hit.parent == partsss and hit.Parent.Name ~= plr.Name and not hitOnce then
print(partsss)
print(hit)
hitOnce = true
hitter.BrickColor = BrickColor.Green()
if hit.Parent:IsDescendantOf(wall) and hit.Parent.Name ~= plr.Name and not hitOnce then
print(partsss)
print(hit)
hitOnce = true
hitter.BrickColor = BrickColor.Green()
Maybe it does detect that its from the folder but the if statement somehow fails because of the other checks?
from what iāve seen it checks when part is touched by a player
but then if it is a player then the if statement fails
i dont really understand what your code tbh so i dont really know
omg⦠i copied and pasted hit.Parent.Name ~= plr.Name so i could make sure it doesnt hit the player but didnt notice it also checks for the player name in it
but how would that work? both the wall and hitbox needs to be anchored since their walls and hitboxes, also i did try it on un anchoring the hitbox but it just falls thru the floor
thatās not how youāre supposed to use itā¦- itās like raycast, you should read the documentary or⦠watch a tutorial⦠it gives you a table with what objects is touching the object
local OverlapParameters = OverlapParams.new()
OverlapParameters.FilterType = Enum.RaycastFilterType.Exclude
OverlapParameters:AddToFilter(WallPartorHitboxPartWhateverHere)
local Result = workspace:GetPartsInPart(WallPartorHitboxPartWhateverHere, OverlapParameters)
if #Result >= 1 then
print("it's touching sumthin..")
for i,v in Result do
print("It's Touching " .. v.Name)
end
end
There might be errors in this code since i wrote it on mobile, BUT, should be easy to figure out
And itās different than Touching, you might need to run this on a loop, since it runs ONCE everytime
ok so ive tried this! it works but not as intended, when ever it touches the part in the wall folder, it just says its a part, not the name of the part, and when i write it as v.parent.name it gives workspace not the folder : p ill try some other things