What is wrong with the following that even when someone else that is not me sit's on the seat they still get the gui?
gui = game.Lighting.Control
function getGUI(u)
print("hit")
local h = u.Parent:FindFirstChild("Humanoid")
if h ~= nil then
print("human")
local user = game.Players:GetPlayerFromCharacter(u.Parent)
local gtest = user.PlayerGui:FindFirstChild("ScreenGui")
print(u.ClassName,u.Name)
if user.Name == "DavidWhitmore" then
if gtest == nil then
local g = gui:Clone()
g.Parent = user.PlayerGui
else return end
print("Done")
end
end
end
script.Parent.Touched:connect(getGUI)

8 comments
try tostring(user.Name).
Remove line 15, it serves no purpose. Also, don't put the GUI in lighting, put it in ReplicatedStorage.
@Sporkzy For which line sorry? @alpha that won't fix this though will it?
line 11 maybe. I really hate comparing names lel
Name is already read as a String. Why would you use tostring on the Players name if it already is a string? Also, Alpha is right, line 15 serves no purpose at all. And don't store things in Lighting; Either use SeverStorage or ReplicatedStorage
I'll try to make you a script once I can access Studio.
I tested this and it works fine....
I tested it and it does not work, If I put the username to someone random and I try and sit on it...It still gives me the Gui