firetouchinterest
Triggers a Touched or TouchEnded event between two parts.
Syntax
firetouchinterest(part: BasePart, target: BasePart, toggle: number) -> voidParameters
| Parameter | Type | Description |
|---|---|---|
part | BasePart | The touching part |
target | BasePart | The part to touch |
toggle | number | 0 = TouchEnded, 1 = Touched |
Returns
This function does not return a value.
Description
firetouchinterest simulates a touch between two parts, firing the Touched or TouchEnded events without physical contact.
Example
local character = game.Players.LocalPlayer.Character
local hrp = character.HumanoidRootPart
local targetPart = workspace.TouchPart
-- Simulate touch start
firetouchinterest(hrp, targetPart, 1)
-- Simulate touch end
firetouchinterest(hrp, targetPart, 0)Touch and Release
local function touch(part, target)
firetouchinterest(part, target, 1) -- Touch
task.wait()
firetouchinterest(part, target, 0) -- Release
end
touch(hrp, workspace.Coin)Collecting Items
local function collectTouchParts(parent)
local hrp = game.Players.LocalPlayer.Character.HumanoidRootPart
for _, part in ipairs(parent:GetChildren()) do
if part:IsA("BasePart") then
firetouchinterest(hrp, part, 1)
task.wait()
firetouchinterest(hrp, part, 0)
end
end
endNotes
- Toggle: 1 = Touched (start), 0 = TouchEnded (end)
- Both events should be fired for proper simulation