? when a player resets, all code is cloned and reset-ed as well
Correct
Characters Characters Characters
No, the script is in the playerscripts, so it doesnât reset, however when a player respawns then the UI resets. I can try changing this, but I donât think it would make a difference.
Oh, ok then. I suggest, if you can, put the script inside the UI, or just put the while loop outside the function that way at least that wonât cause much of an issue.
put the script into player GUI. It needs to always respawn with GUI (since itâs manipulating GUI).
otherwise, you can clone it to player gui?
doing so would solve many inconveniences
Actually, just re-assign the variable when the function is called. Iâve had that issue occur many times before. But still, put the loop outside the function.
Ok sure no problem, I will also say, that these are all fired when the UI is reset so there isnât any waiting, so putting outside wouldnât really change anything from that perspective
I just tried it out, and I forgot, the loop has to go into a function because, once it is leftMouse is false, the loop stops and wonât run again even if leftMouse is true again because the code has already moved to the next line.
Iâm not sure if the variables get updated once called from a function, but I suggest trying to update it within the function that calls the buttons.
You should also change it to a RenderStepped event, hereâs one that checks if leftMouse == true, so that it doesnât move on after it is false.
local rs = game:GetService("RunService").RenderStepped:Connect(function()
if leftMouse == true then
--do stuff
end
end
Yes this is what happens
I will try the renderstepped, also very silly of me I could have just put the if statement inside the whole loop and it wouldnât have that issue.
Oh, so the issue was the buttons not updating?
No, I am saying yes the variables are updated inside the function that calls the buttons.
looks like a UI issue to me try removing the background UI and see if the problem persists.
We put the UI at the front most part of all the other screens, and tried putting them by themselves in a separate place.
Ok, I just tried this, and I still seem to be getting the same issue
you might have to completely rewrite your control script here:
perhaps the system causes these inconveniences? cause normally, you donât need that leftOff() functionâŚ
You might want to look into the touch events (TouchLongPress, TouchTap), they might solve this problem. You could also look at the x and y parts of the input with input changed the make sure itâs within the borders of the button. I recall there is also a module somewhere that fixes something like this.
Edit:
Here is that module:
Though the positioning axis is a cool idea, I will try it out.