-
I want to achieve a system where if you click a part WHILE a specific GUI is visible on screen, you lower it and then the script is disabled, and then you have the ability to raise it back up if you click it with another specific GUI to “reset the part back to it’s original position” then disable the raising reset and enabling the lowering. (I already finished the lowering part and all the disabling stuff, I’m just having problems with actually resetting it)
-
I can’t seem to get to this point. With everything I’ve tried, I just wasn’t able to reset the part back, and it would sometimes interfere with the lowering and the lowering wouldn’t even work.
-
I have tried so many little modifications, I can’t find anything that can fix this.
This is the current form of the GUI script.
local raisegui = script.Parent
local plot = workspace.normalPlot
local Check1 = raisegui.Visible == true
local Check2 = workspace.normalPlot.ClickDetector.MaxActivationDistance < 1
local Check3 = plot.Position.Y > 0
local button = script.Parent.Parent
if plot.Position.Y > 0 then
script.Disabled = true
wait(5)
print("Not lowered")
elseif plot.Position.Y < 0 then
script.Disabled = false
wait(5)
print("Lowered")
end
if script.Disabled == false then
function click()
wait(0.1)
print(Check1)
print(Check2)
print(Check3)
if raisegui.Visible == true and Check2 then
plot.ClickDetector.MaxActivationDistance = 20
script.Disabled = true
elseif Check3 then
warn("One of the checks didn't return back true")
plot.ClickDetector.MaxActivationDistance = 0
script.Disabled = true
end
end
end
button.MouseButton1Click:Connect(click)
This is the current form of raising back the part.
local plot = script.Parent
local click = script.Parent.ClickDetector
local raisegui = game.StarterGui.PCGUI.MenuGUI.InGameGUI.TerrainBtn.TerrainFrame.AddTBtn.RaiseTerrainHelp
local function moveUP()
if game.StarterGui.PCGUI.MenuGUI.InGameGUI.TerrainBtn.TerrainFrame.AddTBtn.RaiseTerrainHelp.RaiseGUIScript.Disabled == false then
plot.Position = plot.Position + Vector3.new (0,10, 0)
if plot.Position.Y < 0 then
plot.ClickDetector.MaxActivationDistance = 0
end
end
end
click.MouseClick:Connect(moveUP)