Ad
Log in to vote
0

Button lets me click once but wont after the second?

Asked by 15 days ago

When I click a part in the workspace it is supposed to show a frame but it works one time then when you close the frame and try to click the part again it wont show here is the code to the part that shows the frame (Script)

local cd = script.Parent.ClickDetector

cd.MouseClick:Connect(function(click)
    local player = game.Players:FindFirstChild(click.Name)
    player.PlayerGui.Heist1GUI.Code.Visible = true
end)

Here is the code that hides the frame (LocalScript)

local frame = script.Parent
local ex = script.Parent.Exit

ex.MouseButton1Click:Connect(function(click)
    frame.Visible = false
end)

1 answer

Log in to vote
0
Answered by 15 days ago

Making it visible with a server sided script and using a local script to make it invisible would be the problem. The server still thinks that the frame is visible. To fix this, put the code in the same type of script. In your case, it would be easiest to make them both server sided, although I don't recommend using regular scripts for UI.

0
^ You can also just add a line to make the frame invisible server side right before making it visible Leamir 3088 — 15d
Ad

Answer this question