I've been working on this game and when you touch a certain block it detects if you have a certain gui, and if you don't you recieve the gui via :clone() The problem I'm having is, the script works, just I want the output fully cleared of errors. Don't post any answers on clearing the output.
Heres the code:
function onTouched(hit)
hit = game.Players:GetPlayerFromCharacter(hit.Parent)
if hit.PlayerGui:FindFirstChild("SampleGui") ~= nil then
print("User already has menu!")
else
print("User recieved menu!")
gui = game.ServerStorage.UserInterface.SampleGui:clone()
gui.Parent = hit.PlayerGui
wait(2)
end
end
script.Parent.Touched:connect(onTouched)
I'm recieving the error: Workspace.City_Hall.SelectCityHall.Script:6: attempt to index local 'hit' (a nil value)
Please help.

4 comments
Keep it short and simple next time ^~^, cant be bother to read them all.
No :P
Too much informations, too lazy to read them all, so keep it short and simple pwease! ^~^
The answer wasn't.... No. Don't tell me how to answer questions. Thank you.