Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is firing an event from a function incorrect?

Asked by 4 years ago
Edited 4 years ago

So I have a function that listening to an event, the event already has a written function inside of it:

function Normal()
    mouse.Button1Down:Connect(mouseClick)
end

My question is, I'm not sure if that is a good idea to put an event like that. If it is okay to put it like that, does it come with any down sides? If not is there an alternative?

0
? AizakkuZ 226 — 4y

1 answer

Log in to vote
0
Answered by
VitroxVox 884 Moderation Voter
4 years ago

Hello, the downside about that is it won't capture your mouse clicks unless you run that function called "normal" because of it's in a function it can't run until the function is called, the mouse capturing event will only and only listen when the "normal" function is fired and when it's done with firing the function and the function ends so will the capture event, so you shouldn't put a mouse capturing event inside a function.

0
So I am trying to make ‘zombie classes’ for a zombie game. Different classes have the same events but are scripted differently for their class. So I don’t want like 4 listeners I want only 1 listener. Is it fine whenever I change the class I would disconnect the previous class’s event and reconnect to a new one? 123nabilben123 499 — 4y
0
Sure. VitroxVox 884 — 4y
Ad

Answer this question