Npc being visible to only one player and disappearing when it looks off doesn't work

So recently i’ve been searching all up but it simply does not work and nobody around me knows how to do it or achieve it

Basically, what i’m trying to achieve is to make in so when u spawn in the game a npc spawns randomly only visible for one player around the map and the after some trigger that i may already got planned so not really needing to solve about that, it would make him dissapear after you looked away from him or got close to him

I can’t put it to work doesn’t matter if i use remotes or local scripts like some said it wont work some how, also, if my problem is actually pretty easy like a local script or something i messed up its probally cuz its been a long time since i dont use roblox studio that much

I looked in discord servers and in the devhub

My current local script (that they said me to do like, just for test) i used looks like somewhat like this:

local part = workspace.Part

part.Touched:Connect(function()
	part.Transparency = 1
end)

And the remote event one just called for a player that was choosen but also somehow not even worked

2 Likes

You don’t need a remote event if all the functionality is happening for one player only. You could set it up so whatever trigger have planned would call a function like this:

LocalScript:

local function hideNpc(npc: Model)
	for _, v in npc:GetDescendants() do
		if v:IsA("BasePart") then
			v.Transparency = 1
		end
	end
end

-- some trigger would call the hideNpc function later on...
hideNpc(THE NPC MODEL YOU WANT TO HIDE)
1 Like

Thank you that really helped me, not exactly what i wanted but still works for what im doing.

1 Like