✓ Accepted answer
Like I stated previously, "InsertService" will be more laggy than a pre-created GUI in StarterGui. It makes the game much more dependent on the ROBLOX servers as well, which will cause a plethora of issues.
Assuming what you're trying to spawn in with it is a GUI, you could just insert that and place it into StarterGui. Then, use hit.PlayerGui.GUINameHere.FirstFrame.Visible = true, where GUINameHere is the name of your GUI, and FirstFrame is the name of the frame which holds everything else (assuming only one frame is doing this; multiple will require this being done for each direct child of GUI).
You can completely get rid of line 8 and 5, since 1 handles all of the calling you will need. You could also get rid of line 4 and 9, since they serve no visible purpose.
EDIT:
local plr = game.Players.LocalPlayer
game.Workspace.JimmyTheBlacksmith.Torso:connect(function(hit)
hit.PlayerGui.GUINameHere.FirstFrame.Visible = true
end)
With this code, you will also want to decide how you want the GUI to become visible = false. My suggestion would be placing a block into the doorway, that when touched, finds the GUI inside the player and changes its visibility to false. (it doesn't matter much if its already off, as long as you add a debounce)
5 comments
What "doorway" are you talking about??!! my game only has this man standing on a baseplate.
Also, that pull up gui is still not working. my script is: game.Workspace.JimmyTheBlacksmith.Torso:connect(function(hit)
hit.PlayerGui.BluesteelBow.main.Visible = true end)
This was assuming that it was in a building. The important part of this is the block being placed in the theoretical doorway. And have you added the GUI to the StarterGui yet?
umm ya i added the gui into startergui. i'll make it so you can see whats inside later. and i'm making him on a stand.