local players = game:GetService("Players")
while task.wait() do
local touching = game.Workspace:GetPartsInPart(script.Parent)
local playerInPart = false
for i, v in pairs(touching) do
if v.Parent:FindFirstChild("Humanoid") ~= nil then
playerInPart = true
if true then
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Ragdoll = require(ReplicatedStorage.Ragdoll)
v.Parent.Humanoid.Health = 0
Ragdoll(v)
end
end
end
end
i just end up clipping through, touch doesn’t work with cancollide false anymore so i dunno what i could do
local players = game:GetService("Players")
while task.wait() do
local touching = game.Workspace:GetPartsInPart(script.Parent)
local playerInPart = false
for i, v in pairs(touching) do
if v.Parent:FindFirstChild("Humanoid") ~= nil then
playerInPart = true
else
playerInPart = false
end
if playerInPart then
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Ragdoll = require(ReplicatedStorage.Ragdoll)
v.Parent.Humanoid.Health = 0
Ragdoll(v)
end
end
end
Even when CanCollide is disabled, parts may still fire the BasePart.Touched event (as well the other parts touching them)
I have also tested myself to make sure this statement is true.
Also, it appears you’re trying to call the ragdoll function on the individual part that touched it instead of the player model, not sure if this was intended but if it was change line 12 to v
local ReplicatedS = game:GetService("ReplicatedStorage")
local Ragdoll = require(ReplicatedS.Ragdoll)
script.Parent.Touched:Connect(function()
local touching = game.Workspace:GetPartsInPart(script.Parent)
for i, v in pairs(touching) do
if not v.Parent then return end
local hum = v.Parent:FindFirstChildOfClass("Humanoid")
if hum then
hum.Health = 0
Ragdoll(v.Parent)
end
end
end)
Read my original post, Touched DOES work with CanCollide set to false. Tell me what this prints
local ReplicatedS = game:GetService("ReplicatedStorage")
local Ragdoll = require(ReplicatedS.Ragdoll)
script.Parent.Touched:Connect(function(Target)
print("Touched by " .. Target.Name)
if not Target.Parent then return end
local hum = Target.Parent:FindFirstChildOfClass("Humanoid")
if hum then
print("It has a humanoid!")
hum.Health = 0
Ragdoll(Target.Parent)
end
end)
I just checked in my own game, it still works. The game was last updated July of last year.
If the part was invisible and unanchored with cancollide off, then it probably fell into the void and you didn’t notice. Try using the touched event again.