As the title says, how could I make custom signals such as: GuiButton.MouseButton1Hold
?
For example:
local GuiButton = script.Parent
GuiButton.MouseButton1Hold:Connect(function()
-- blah blah blah
end)
As the title says, how could I make custom signals such as: GuiButton.MouseButton1Hold
?
For example:
local GuiButton = script.Parent
GuiButton.MouseButton1Hold:Connect(function()
-- blah blah blah
end)
What are you talking about dude?
It’s not working. It’s not a real signal. Do you understand???
You’re such a joke.
Ignore that person, he’s spamming the forum. Regarding your problem, do you want this?: MouseButtonOneClick:Connect(something) if you need to hold the button, there is a separate signal when you release the button, and then up, but now I forgot what the signal is called.
Sorry for the misunderstanding, that was just an example.
Oh, I understand now. I’m not sure about this. I know that it can be done, for example, through modules, but I don’t know if it would be complicated. However, I have never made modules, so I can’t help you. Maybe look at how to make module scripts. If it can be done in another way, please correct me if anyone knows.
I know how to make modules, I just need help making custom signals.
Custom events for example? Have you heard about bindables?
Yes, I have indeed heard about bindables.
But why would I need to use them?
Well I don’t really use them much but, their main uses are for like custom events/functions and communicating between scripts. I’ve not needed them much but I think they may be useful for your situation.
Pretty sure many story/horror games use bindables to keep scripts running in a certain order.
Well, I’m not trying to do that.
Yeah but you are trying to make a custom event/function right?
Yeah?
If not, what would be the purpose of this topic?
Yeah so bindables are also used for custom events/functions, not just communicating between scripts. You can use either one.
Hm. I don’t get it?
Aren’t events like .MouseButton1Click a signal?
Look at this:
Yeah they’re, but don’t you wanna make custom signals? If you do then you can use bindables. Let me write out some code.
Why do I need to use bindables?
It’s not like I’m trying to do BindableEvent:Fire()
.
Well they’re sort of custom signals because you can name them custom things I guess, they’re the closest you can get to making a “custom signal”.
You can’t actually do this but if you wanted to check if the player is holding it down using the mousebutton1up and down event.
GuiButton.MouseButton1Down:Connect(function()
-- Fires when the player presses the left mouse button
end)
GuiButton.MouseButton1Up:Connect(function()
-- Fires when the user releases the left mouse up off the GUI button.
end)
You can also then add a bindable:Fire() if you wanted to. But bindables are really the closest you can get to making your own custom signals. You can also use custom module names which would give you the illusion of making a “custom signal”.