i have a problem with a local here is the script
local plr = game.Players.LocalPlayer local casa = workspace.casaAvere local sound = script.wrong local gui = plr.PlayerGui.hous script.Parent.ClickDetector.MouseClick:Connect(function(player) if not casa.Value == true then if player.leaderstats.bobux.Value>50 then local name = script.Parent.teSTO.name player.leaderstats.bobux.Value = player.leaderstats.bobux.Value-50 local textlabel = script.Parent.teSTO.SurfaceGui.TextLabel name.Value = player.Name textlabel.Text = name.Value .."'s house" casa.Value = true end end if casa.Value == true then gui.Enabled = true sound:Play() wait(2) gui.Enabled = false end end)
here is the error Workspace.test.Script:4: attempt to index nil with 'PlayerGui'
i fixed the script
local casa = workspace.casaAvere script.Parent.ClickDetector.MouseClick:Connect(function(player) local gui = player.PlayerGui.hous if not casa.Value == true then if player.leaderstats.bobux.Value>50 then local name = script.Parent.teSTO.name player.leaderstats.bobux.Value = player.leaderstats.bobux.Value-50 local textlabel = script.Parent.teSTO.SurfaceGui.TextLabel name.Value = player.Name textlabel.Text = name.Value .."'s house" wait(2) casa.Value = true end end end)
.
local casa = workspace.casaAvere local sound = script.wrong script.Parent.ClickDetector.MouseClick:Connect(function(player) local gui = player.PlayerGui.hous if casa.Value == true then gui.Enabled = true sound:Play() wait(2) gui.Enabled = false end end)
i divided the scriptt in 2 so the gui wont appear for the first time