So what I'm trying to do is to make a function that only happens when the enemy player is touching the stunned player.
Unfortunately my method of detecting it doesn't work for some reason:
(char is the stunned player's character and player is the enemy player)
local touchingChar = false
for _, bodyPart in pairs(char:GetChildren()) do
if bodyPart:IsA("BasePart") then
for _, part in pairs(bodyPart:GetTouchingParts()) do
local hum = part.Parent:FindFirstChild("Humanoid")
if hum and Players:GetPlayerFromCharacter(part.Parent) == player then
touchingChar = true
break
end
end
end
end
if not touchingChar then return end
Please help!
EDIT: This function only fires when the enemy player presses a key, so I need to know if he's touching the stunned player at that very moment.

2 comments
again, .Touched function?
I don't really understand your question. Can I get a little more information and what you actually need?