Hello! So I have a GUI and I want it to be enabled when a player clicks something. When I run this though, on line 21, I get an issue saying the GUI is not valid. Upon seeing this issue, I looked into the hierarchy of and I cannot find where any of the GUIs are. I am using filtering enabled so how can I get the GUI to become enabled?
The rest of the script works so no need to worry.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local landPurchaseEvent = Instance.new("RemoteEvent")
landPurchaseEvent.Name = "LandPurchased"
landPurchaseEvent.Parent = ReplicatedStorage
local event = game:GetService("ReplicatedStorage").LandPurchased
local price = 700
local land = game.Workspace.Land1
local function onEvent(player,money)
if player.leaderstats.Money.Value > price - 1 and player.PlayerOwnsLand.Value == false then
player.leaderstats.Money.Value = player.leaderstats.Money.Value - price -- Assuming it's leadersats in the player
land.Owner.Value = player.Name
land.ForSaleSign.Click.SurfaceGui.Price.Text = ("OWNED BY: "..player.Name)
player.PlayerOwnsLand.Value = true
--land.Sell.Position = Vector3.new(land.Sign.Click.Position.X,land.Sign.Click.Position.Y,land.Sign.Click.Position.Z)
land.ForSaleSign.Click.Script.Disabled = true
print("Purchased")
--
local list = player.PlayerGui.HouseOptionsPlot1
list.Enabled = true
--
else
print("Purchasing Error")
end
end
event.OnServerEvent:Connect(onEvent)

1 comment
In FE, the Server doesn't have access to the PlayerGUI or at least the StarterGUIs that are added to the player. I would just send a RemoteEvent to the client to enable the GUI.