Custom Events like .Touched

Im just asking, but is there any chance i can make a custom event for something?
Example:

local Part = Instance.new("Part")

Part.Moved:Connect(function() -- .Moved is not a valid event but can i create an event for it?
end)

So is there any way i can make that?
the ChatServiceRunner.ChatService uses .SpeakerAdded i think thats created by that script.
so anything like that possible? =)

1 Like

(How can I create custom events? - #5 by EncodedLua) This should help.

1 Like

you could try something like:

local function Moved (instance, pastPosition)
   if instance.Position ~= pastPosition then
      return true
   else
      return false
end

Moved(game.Workspace.Part, <position here>):Connect(function()
   --do what you want
end)

just an idea

You are just connecting the result of one function to another function. This also isn’t an event since it only gets called once. This could isn’t going to work how you want it to.

add it inside a

task.spawn()

then

You can’t connect a boolean to a function. A boolean is not an event.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.