firetouchinterest
Avoid implementing in Luau
This function should not be implemented in Luau. Doing so exposes you to easy detection vectors.
firetouchinterest
simulates a physical touch event between two BasePart
objects. It can emulate both the start and end of a Touched
event.
function firetouchinterest(part1: BasePart, part2: BasePart, toggle: boolean | number): ()
Parameters
Parameter |
Description |
part1 |
The initiating BasePart . |
part2 |
The BasePart that should be touched. |
toggle |
Whether to simulate touch start or end. true or 0 simulates touch; false or 1 simulates un-touch. |
Examples
Example 1
Simulating a Touched event using 'true/false' |
---|
| local dummy_part = Instance.new("Part")
dummy_part.CFrame = CFrame.new(0, -200, 0)
dummy_part.Anchored = true
dummy_part.Parent = workspace
dummy_part.Touched:Connect(function(part)
print(part.Name .. " touched the dummy part!")
end)
local player_head = game.Players.LocalPlayer.Character.Head
firetouchinterest(player_head, dummy_part, true) -- Simulate touch
task.wait(0.5)
firetouchinterest(player_head, dummy_part, false) -- Simulate un-touch
|
Example 2
Simulating a Touched event using '0/1' |
---|
| local dummy_part = Instance.new("Part")
dummy_part.CFrame = CFrame.new(0, -200, 0)
dummy_part.Anchored = true
dummy_part.Parent = workspace
dummy_part.Touched:Connect(function(part)
print(part.Name .. " touched the dummy part!")
end)
local player_head = game.Players.LocalPlayer.Character.Head
firetouchinterest(player_head, dummy_part, 0) -- Simulate touch
task.wait(0.5)
firetouchinterest(player_head, dummy_part, 1) -- Simulate un-touch
|