I'm pretty confused on this topic. I've looked around and found some things but nothing really explaining how to do it. I know that I have to set the parent of the part into the player's camera for only them to see it, but I'm not quite sure how to do this.
Sorry I've already deleted the script that I had so far that didn't work, but basically once the player joins, there is a model containing everything that I want in the player's camera. The model is cloned from somewhere and inserted into the camera making it so only the player can see the object.
What I'm trying to do is have a NPC run after you, but I don't want it running after other people. I want it so each person gets there own NPC that runs after only them. Also sorry for making this long thanks for reading though.
Any answers would be appreciated as I've been stuck on this for the past few days.
One of the forums I found concerning this topic
v v v
https://forum.roblox.com/Forum/ShowPost.aspx?PostID=50360102
With FilteringEnabled
toggled on, (property of workspace), simply create a part via a Local Script
, somewhere local scripts run in, like ReplicatedFirst.
Any changes made via a LocalScript with FilteringEnabled
toggled on will remain local, and not replicate to the server. (except in some special cases)
-- local script in ReplicatedFirst with FilteringEnabled toggled on local p = Instance.new("Part") p.Parent = workspace p.Position = Vector3.new(0,0,0)
Here's an example for your case:
-- local script in ReplicatedFirst with FilteringEnabled toggled on local npc = game.ReplicatedStorage:WaitForChild("NPC") -- make sure you put NPC in repStorage local partToTouch = workspace:WaitForChild("Part") local plr = game.Players.LocalPlayer partToTouch.Touched:Connect(function(hit) if(game.Players:GetPlayerFromCharacter(hit.Parent)==plr)then npc:Clone().Parent = workspace end end)
The best solution would be to turn on FilteringEnabled and then create those objects on the clients. That way the server will block replication regarding those objects, but they will function just fine for their respective players.
Locked by Goulstem
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?