I've read and did what RoboFrog told me to do on the last question, but my script is still not working.
game.Workspace.JimmyTheBlacksmith.Torso:connect(function(hit) -- Code goes here local plr = game.Players.LocalPlayer function PullUpGuiOnClick() game.Workspace.JimmyTheBlacksmith.Torso:connect() -- This part was edited game:GetService("InsertService"):LoadAsset(185218430).Parent = plr.PlayerGui game.Workspace.JimmyTheBlacksmith.Torso:connect() PullUpGuiOnClick() end end)
is the script I currently have.
Thanks for reading!
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 -- Read above on how to modify this. 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)