BasePart.Touched
Fires when a BasePart begins a new Workspace contact.
Syntax
basePart.Touched:Connect(function(hit) ... end)Callback argument
| Name | Type | Description |
|---|---|---|
hit | BasePart | The other BasePart involved in the new contact. |
Behaviour
Touched is available to both public ServerScript and LocalScript code on Part and SpawnLocation. ServerScripts evaluate the authoritative Workspace state. LocalScripts evaluate that client's replicated/local Workspace state, and ordinary property changes made by a LocalScript callback stay local unless the script explicitly communicates through a RemoteEvent or RemoteFunction.
ServerScript contact evaluation runs after authoritative physics so a physical movement is not scanned once before physics and then again after it. Client-side contact evaluation uses the local replicated transforms after the client updates them.
When a Touched signal is first connected, contacts that already exist are recorded as baseline state and do not immediately fire. A continuously touching pair also does not fire every frame. The pair must stop touching and later begin a new contact before another callback can occur.
Contact checks use the Parts' oriented transforms instead of a large world-axis bounding box. Static listener Parts only test against Parts that actually moved, rotated or resized that frame. This avoids nearby anchored map pieces being reported as new contacts and prevents neighbouring Touched scripts from producing static chain reactions.
BaseParts belonging to a dead Humanoid are ignored by Touched, so detached death parts do not create a new burst of callbacks.
Touched when a moving character or other moving Part enters it. Parts outside Workspace are not active Workspace contact geometry.Example: damage a character on the server
local damagePart = script.Parent
damagePart.Touched:Connect(function(hit)
local character = hit.Parent
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:TakeDamage(25)
end
end)ServerScript. A LocalScript can use the same event for client-only effects and property changes, but authoritative Humanoid changes remain server-side.