local guiname = "PurchaseGUI"
script.Parent.Touched:connect(function(hit)
if hit == nil then return end
if hit.Parent == nil then return end
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player ~= nil then
if player:FindFirstChild("PlayerGui") then
print("this is working")
if not player.PlayerGui:FindFirstChild(guiname) then
print("this is where the script stops working")
local ui = script:FindFirstChild(guiname):clone()
ui.Parent = player.PlayerGui
end
end
end
end)
Hey all, thanks for reading! At
print("this is where the script stops working")
The script stops working, who would have guessed ¯_(?)_/¯. I don't know why it stops but its probably a really obvious,
if not player.PlayerGui:FindFirstChild(guiname) then
That is the line that errors, Thanks!

5 comments
What is the error?
Nothing, thats why im confused
maybe you should delete the " from the local name
^ That wouldn't change anything. As for my recommendation, I would double check the name of the Gui in the script, because it's possible that you may have made a little typo. I've done this before and was confused when it couldn't find the child because I had mistyped the name.
if you post that in answers, id be glad to accept, i cant type for some reason