So the script is inside a part and when i press play i always get this error in the output if i remove FindFirstChild i then get the error attempt to index nil with 'PlayerGui' and same error with WaitForChild i cant find a way to work around it
local ss = script.Parent
local player = game:GetService("Players").LocalPlayer
local pGui = player:FindFirstChild("PlayerGui") --error happens here
local debounce = false
ss.Touched:Connect(function(tuch)
if tuch and debounce == false then
local pGui = game.Players.LocalPlayer:FindFirstChild("PlayerGui")
local cost = tuch.Cost.Value
local name = tuch.Name.Value
pGui.Perks.ValueText.Text = "PRESS F TO PURCHASE COST ["..tostring(cost).."] POINTS"
pGui.Perks.Enabled = true
end
end)
ss.TouchEnded:Connect(function(tuch)
pGui.Perks.Enabled = false
end)

3 comments
try :WaitForChild() instead?
attempt to index nil with 'WaitForChild' throws the same error
Layz it is because you are trying to get it on the server, the rest of the script does not work, when you get an error it doesn't run the rest of the script regardless, just stops where the error is, it says attempt to index nil with FindFirstChild because the player is nil since local player is not on the server