I made a script that gives you a different GUI depending on the name of an object. However, the script only works if the object has the specified name, and doesn't give you any GUI if the name is different. Here is the script:
function loadscreen(Player) if script.Parent.Parent.Name == "TB" .. Player.Name then if not Player.PlayerGui:FindFirstChild("Gui") then local gui = script.Gui:clone() gui.Parent = Player.PlayerGui else if not Player.PlayerGui:FindFirstChild("nope") then local guin = script.nope:clone() guin.Parent = Player.PlayerGui end end end end script.Parent.ClickDetector.MouseClick:connect(loadscreen)
The part of the script after the 'else' part is the part that does not work. There are no errors in the output. Please help?
Try changing line two to,
if script.Parent.Parent.Name == ("TB"..Player.Name) then
It's also worth noting that while filtering enabled is on click detectors don't work like you would expect and it doesn't return Player. So in order to fix this you would need to use Romote events.
You probably don't need to change your script. Just set up a remote event to fix this problem.
Good luck!