So, I have a button to make the UI's Enabled factor to set to false (I.E making it invisible) and I have a button to make it enabled again to make it visible, but when it comes back visible, the scripts arent doing their job correctly. I did check while in the studio to see if the enabled factors of the scripts were set to enabled, and they were, but the scripts did not work after, and there are no errors, can someone help me figure it out?
Also: here are the scripts for enabling and disabling
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Enabled = false
script.Parent.Parent.Parent.WhichGive.Enabled = false
script.Parent.Parent.Parent.Background.getitback.Visible = true
end)
Disabling script above (not local) (this is in a textbutton in screen gui "GiveDie" )
Enabling script below: (is local) (this is in a textbutton in a screengui called background, currently invisble when join game)
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.GiveDie.Enabled = true
end)
Local scripts inside textbuttons inside "GiveDie" UI
(all the same)
local player = game.Players.LocalPlayer
local playergui = player:FindFirstChild("PlayerGui")
script.Parent.MouseButton1Click:Connect(function()
if not playergui.WhichGive.BACKI.Visible then
playergui.WhichGive.BACKI.Visible = true
else
playergui.WhichGive.BACKI.Visible = false
script.Parent.Parent.Parent.WhichGive.BACKI.thename.Text = script.Parent.Text
end
end)

2 comments
Actually you can use Server Scripts, the problem in his code is because the way roblox replicates values, if its already that value on the server, it will not replicate
And its better using player.PlayerGui, it makes code more readable and is "global"