Hello! I have a simple script here, under the influence of which the cold-gray part turns into green neon, and when you click on it, the red neon is rendered.
And I want the consequences of this scenario to be repeated endlessly, that is, automatically, without the need to reproduce this action manually.
So that when you click on the red neon part, it does not remain so, but turns green again, as before, and when you press it again, it turns red again and so endlessly.
Could you please tell a beginner how he can implement such a looped causal relationship in his game?
Now that I have explained to you what I am trying to achieve and what I am asking for help with, namely to add a few necessary lines, let me acquaint you with this script:
local SB = game.Workspace.SquareButton
SB.BrickColor = BrickColor.Green()
SB.Material = Enum.Material.Neon
SB.Position = Vector 3.new(-179.5, 0.5, 37.5)
SB.Anchored = true
function Change()
local P = script.Parent
P.BrickColor = BrickColor.Red()
P.Material = Enum.Material.Neon
P.Position = Vector 3.new(-179.5, -0.4, 37.5)
end
script.Parent.ClickDetector.MouseClick:connect(Change)
Of course. I will definitely try your suggested ways to solve this problem. Only I will need some time for this, but I am sure that her solution is already here…