So I have no idea why this code is not working. There isn’t even a error.
local framef = game.StarterGui.ScreenGui.Framef
button.MouseButton1Click:Connect(function()
framef.Visible = true
end)
So I have no idea why this code is not working. There isn’t even a error.
local framef = game.StarterGui.ScreenGui.Framef
button.MouseButton1Click:Connect(function()
framef.Visible = true
end)
You’re setting the visiblity of the frame inside StarterGui
. You should use a LocalScript
and set the visibility of the frame inside the current LocalPlayer
’s PlayerGui
as all contents of StarterGui
get replicated to the client’s PlayerGui
and are “rendered” via there.
Some example code:
local players = game:GetService("Players")
local client = players.LocalPlayer
local playerGui = client:WaitForChild("PlayerGui")
local starterGui = playerGui:WaitForChild("StarterGui")
local framef = starterGui:WaitForChild("Framef")
--// assuming you have `button` defined elsewhere.
button.MouseButton1Click:Connect(function()
framef.Visible = true
end)
I ended up using another script, as your script didn’t work. But thank you for the help!
You haven’t specified where the button is. Try this script instead
local button = script.Parent
local framef = game.StarterGui.ScreenGui.Framef
button.MouseButton1Click:Connect(function()
framef.Visible = true
end)
Make sure the script is inside the button and it’s a local script.