#Why is the click not registered?
1 messages · Page 1 of 1 (latest)
We need to see the code
local MiTool = script.Parent
local Emitor_De_Luz = script.Parent["Emitor de luz"]
local SpotLight = Emitor_De_Luz.SpotLight
local EstaEncendida = false
MiTool.Activated:Connect(function()
if EstaEncendida == false then
print("Linterna prendida")
EstaEncendida = true
Emitor_De_Luz.BrickColor = BrickColor.new("Institutional white")
SpotLight.Enabled = true
elseif EstaEncendida == true then
print("Linterna apagada")
EstaEncendida = false
Emitor_De_Luz.BrickColor =BrickColor.new("Black")
SpotLight.Enabled = false
end
end)
im spanish speaker srry if something looks weird
So what exactly is the issue here? Can you show?
That's exactly what I'm wondering, it's a flashlight switching between on and off but it only registers when the click is released but not when it is initially pressed
So you press the mouse down, and it turns on, yes?
yes yes
** You are now Level 1! **
and when you release your mouse and press again, it does not work?
no, it does not work
If you want something to happen when you release the mouse, you need to use .Deactivated. Activated is for pressing the mouse down
MiTool.Activated:Connect(function()
if EstaEncendida == false then
print("Linterna prendida")
I know, here it is
no, you need to use both .Deactivated and .Activated, two events for a tool
.Activated = mouse pressed
.Deactivated = mouse released
OHHH
Let me fix it and I'll come back, also thanks for telling me, I didn't know that.
Good stuff
** You are now Level 8! **
I mean im also a spanish speaker but its really odd looking at code like that
Also mind if i question why do you put [Emisor_De_Luz]?
At the end of giving a place to emisor de luz
Shouldn't it be just script.parent?
That is the name of the object that emits the light
I still don't understand the logic well, if something works I don't change it much
If its the parent of the script just do script.parent 
you are gonna give an english speaker a stroke
lowk
But aight gl
Have you fixed it yet tho?
local MiTool = script.Parent
local Emitor_De_Luz = script.Parent["Emitor de luz"]
local SpotLight = Emitor_De_Luz.SpotLight
MiTool.Activated:Connect(function()
--aqui la encendere
end)
MiTool.Deactivated:Connect(function()
--aqui no po
end)
It returns errors if I don't put "Emitor de luz"
No idea, im also new and mostly i use script.parent
Or workspace: Waitforchild()
And it runs smoothly
Oh its because its a model

yes
** You are now Level 2! **
I made the prints to demonstrate that the initial keystroke is not registered
that's very strange.
Can you check the ManualActivationOnly property?
activación manual solamente
I haven't read the documentation for that term yet, I'll go read it and tell you how it went.
Its on the tool itself, in the explorer
"la característica" I think is the translation for english "Properties"
Screenshot it for me?
here
okay so it is in English
ManualActivationOnly should be false, or unchecked
It's okay! you didn't know it would do that