Hello, so i made a NPC GUI that transfers the GUI from workspace (under a dummy HRP) to playerGui, but it doesnt work at all
The script type is LocalScript and i wanna prevent using remoteEvents because i would have to create multiple remoteevents because we will have multiple NPC’s
local players = game:GetService("Players")
local localPlayer = players.LocalPlayer
local work = game:GetService("Workspace")
--Prompt parent and itself
local part = work:WaitForChild("Part")
local prompt = part:WaitForChild("ProximityPrompt")
--Activating it
prompt.Triggered:Connect(function(player)
if player == localPlayer then
local GUI = script:FindFirstAncestor("NPC"):Clone()
GUI.Parent = localPlayer:WaitForChild("PlayerGui")
print("success") -- check if that prints out
end
end)
If the script is a child of the NPC it will not run. If it’s a child of the player it will though. Local scripts do not work in workspace with the exception of being a child of a players character.