sunc docs
  • sUNC Introduction
  • Closures
    • hookfunction
    • hookmetamethod
    • newcclosure
    • iscclosure
    • islclosure
    • isexecutorclosure
    • clonefunction
    • getfunctionhash
  • Cryptography
    • crypt.base64encode
    • crypt.base64decode
  • Debug
    • debug.getconstants
    • debug.getconstant
    • debug.setconstant
    • debug.getupvalues
    • debug.getupvalue
    • debug.setupvalue
  • debug.getstack
  • debug.setstack
  • debug.getprotos
  • debug.getproto
  • Drawing
    • Drawing.new
      • Drawing Objects
    • cleardrawcache
    • getrenderproperty
    • setrenderproperty
    • isrenderobj
  • Environment
    • getgenv
    • getrenv
    • getgc
    • filtergc
  • Filesystem
    • appendfile
    • writefile
    • readfile
    • listfiles
    • isfile
    • delfile
    • loadfile
    • makefolder
    • isfolder
    • delfolder
    • getcustomasset
  • Instances
    • fireproximityprompt
    • fireclickdetector
    • firetouchinterest
    • getinstances
    • getnilinstances
    • cloneref
    • gethui
    • getcallbackvalue
    • compareinstances
  • Metatables
    • getrawmetatable
    • setrawmetatable
    • setreadonly
    • isreadonly
  • Miscellaneous
    • identifyexecutor
    • request
  • Reflection
    • gethiddenproperty
    • sethiddenproperty
    • setscriptable
    • checkcaller
    • setthreadidentity
    • getthreadidentity
  • Scripts
    • getscriptbytecode
    • getscripthash
    • getscriptclosure
    • getsenv
    • getscripts
    • getrunningscripts
    • getloadedmodules
    • getcallingscript
    • loadstring
  • Signals
    • getconnections
      • The Connection object
    • firesignal
    • replicatesignal
  • Websocket
    • WebSocket.connect
Powered by GitBook
On this page
  • Parameter
  • Example
  1. Instances

firetouchinterest

This is an implementation detail; as a regular scripter, you may ignore this!

It's not recommended to implement this function in luau. Doing so will expose you to easy detections. Additionally, when firing the touch interests, the function should yield, in order to allow the next one to fire with no problems.

Both numbers and booleans should be supported for the toggle (1 being true, 0 being false)

Triggers a Touched event on a BasePart with the other wanted part.

function firetouchinterest(part: BasePart, part2: BasePart, toggle: boolean | number): ()

Parameter

  • part - The part initiating the touch.

  • part2 - The part to be touched.

  • toggle - Determines the touching event trigger.

    • false - Starts the Touched event. (Touch, internally).

    • true - Ends the Touched event. (Untouch, internally).


Example

local DummyPart = Instance.new("Part")
DummyPart.CFrame = CFrame.new(0, -200, 0)
DummyPart.Anchored = true
DummyPart.Parent = workspace

DummyPart.Touched:Connect(function(arg1)
    print(arg1:IsDescendantOf(game.Players.LocalPlayer.Character))
end)

firetouchinterest(game.Players.LocalPlayer.Character.Head, DummyPart, false)
task.wait(0.5)
firetouchinterest(game.Players.LocalPlayer.Character.Head, DummyPart, true)
PreviousfireclickdetectorNextgetinstances

Last updated 2 months ago