script.Parent.Touched:connect(function(part)
local s = script.Gui:clone()
s.Parent = game.Players:FindFirstChild(part.Parent.Name).PlayerGui
end)
Clone script won't work. Why?
3 answers
Make sure the humanoid is nil.
I'm guessing what's happening is that something else is hitting the part than a person. If a random flying object hits it, It'll fire, and attempt to find a player called "Part" or whatever the thing that hit it is called. Try putting this inside the function instead.
if part.Parent:FindFirstChild("Humanoid") ~= nil then
local s = script.Gui:clone()
s.Parent = game.Players:FindFirstChild(part.Parent.Name).PlayerGui
end
That'll ensure that whatever hit the part is a person and not some random brick.
Of course, if the part being hit is in an enclosed environment where nothing else can hit it, then I'm completely wrong.
1 comment
Oh... DERP. Thanks... Should of thought of that...
Try to make sure it is actually a robloxian you are dealing with.
To make sure you are dealing with a humanoid , you will need this:
local h = part.Parent:FindFirstChild("Humanoid")
if h ~= nil then
It is saying if the humanoid exists, then it will clone the GUI.
Make sure to add an end for the if+then
Add this with it: (Don't forget to create the function)
local h = part.Parent:FindFirstChild("Humanoid")
if h ~= nil then
local s = script.Gui:clone()
s.Parent = game.Players:FindFirstChild(part.Parent.Name).PlayerGui
end
1 comment
Someone already answered it. Thanks anyway.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Any errors?
Nothing. No errors. I'll check if there is any output.
it says, "Disconnected event because of exception".