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'

1 comment
LocalPlayer is for LocalScript, not Script.