So I made this thing where if you get close to a npc some gui with the letter E shows up to talk to them then idk what happened but like 10 minutes ago as im writing this it decided to not work anymore, I have not done anything to it and I checked output it said
HumanoidRootPart isn’t a valid member of model
Line 4
Heres the script
while wait() do
script.Parent.Visible = false
for i,v in pairs(game.Workspace.NPCS:GetChildren()) do – Finds all the children from the folder. In this case it will find all the NPCs
local mag = (v.UpperTorso.Position-game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude – Makes a variable for the position between the character and the npc.
if mag <= 10 then – If the magnitude is less than or equal to 10 studs then
local WSP = game.Workspace.CurrentCamera:WorldToScreenPoint(v.UpperTorso.Position) – The position of the NPC’s Torso to 2d
script.Parent.Visible = true
script.Parent.Position = UDim2.new(0,WSP.X,0,WSP.Y)
script.Parent.TextLabel.Text = "to chat with "…v.Name – Refreshes the text and puts the name of the npc
end
end
end
Tried renaming it didnt work as well