signated
(signated)
June 20, 2020, 9:22am
1
Greetings, I’ve coded some keybindings that allow me to control ParticleEmitters, Beams, Parts and All Via a simple Button press on my keyboard,
It seems the code is 100% fine, but it is quite delayed, by that I mean;
It is supposed to be a 1 click action, meaning it only needs 1 click to execute the code,
but instead, it makes me click 2 times, for some odd reason. (Keep in mind I am not a professional at this)
If there are any solutions to how to fix this, please provide one.
1 Like
You should provide code snippets as default, so please provide them. We really can’t help you without seeing your code.
signated
(signated)
June 20, 2020, 9:26am
3
Yeah, I realized, ahaha. I was in the middle of snipping some code.
Why do you need to disable the script?
It’s probably where you have:
on = not on
because, on will become the opposite of what it starts with
signated
(signated)
June 20, 2020, 9:34am
5
What do you reckon I should change it to?
Does the variable on start as false or true?
signated
(signated)
June 20, 2020, 9:41am
7
I know this sounds quite mad, but I’m actually not sure.
Use the find results panel and search for either:
local on = true
local on = false
on = true
on = false
signated
(signated)
June 20, 2020, 9:46am
9
Neither of the were recognized.
add this to the start of the server side code and see if it works:
local on = false
sebi210
(sebi210)
June 20, 2020, 9:48am
11
Could you maybe provide the whole code? Copy and Paste it. So it is easier to Quote it.
signated
(signated)
June 20, 2020, 9:50am
12
xuefei123:
Which might that be? (Excuse me for going into this situation blind, I was assisted during the making.
sebi210
(sebi210)
June 20, 2020, 9:52am
13
I think that one on line 59…
signated
(signated)
June 20, 2020, 9:54am
14
function script.FireA.OnServerInvoke()
on = not on
if on then
script.FireAO.Disabled = false
else
script.FireAO.Disabled = true
end
end
function script.FireB.OnServerInvoke()
on = not on
if on then
script.FireBO.Disabled = false
else
script.FireBO.Disabled = true
end
end
function script.FireC.OnServerInvoke()
on = not on
if on then
script.FireCO.Disabled = false
else
script.FireCO.Disabled = true
end
end
function script.CO.OnServerInvoke()
on = not on
if on then
script.CO2.Disabled = false
else
script.CO2.Disabled = true
end
end
function script.COO.OnServerInvoke()
on = not on
if on then
script.CO22.Disabled = false
else
script.CO22.Disabled = true
end
end
function script.SPRK.OnServerInvoke()
on = not on
if on then
script.SPK.Disabled = false
else
script.SPK.Disabled = true
end
end
function script.SPRK1.OnServerInvoke()
on = not on
if on then
script.SPK1.Disabled = false
else
script.SPK1.Disabled = true
end
end
sebi210
(sebi210)
June 20, 2020, 9:55am
15
Format your code like this.
put that line of code at the start of the script.
sebi210
(sebi210)
June 20, 2020, 9:57am
18
Yes you never define on. Put
local on = false;
at the start of the code.
If it works, put solution to Xuefei.
signated
(signated)
June 20, 2020, 10:02am
20
Still doesn’t work, still makes me double click the bind-key, do one of you just want the file for the whole thing to try and fix it?
sebi210
(sebi210)
June 20, 2020, 10:02am
21
Try doing local on = true, then.
signated
(signated)
June 20, 2020, 10:05am
22
sebi210:
local on = true,
Still didnt work, want the file?