Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I make a part using camera?

So I know inorder to make a part that only certain people can walk through I need to use the camera but other then that I am clueless!

1 answer

What you're dealing with is Server to client communication. This idea may be difficult to wap your head around at first, but it gets easier and is essential to learning how to netcode and game develop on roblox.

When you think about the camera, think about something that all clients own separately. In order to get every client to have something, you make the server replicate it to them.

This means manually putting a your part in each of the client's views. The part won't actually exist on the sever, and you can manipulate the part relative to each player.

You need to store your part in ReplicatedStorage, and clone it on each client. Then define a whitelist for who can walk through the part and manipulate it's collision accordingly.

local plr = game.Players.LocalPlayer; 	--Define the client.
local allowed = {"iSidersz","Goulstem"};--Define the whitelist.
local cam = workspace.CurrentCamera; 	--Define the camera.
local part = game.ReplicatedStorage.Part--Define the part.

--Clone the part to the client's camera
local ourPart = part:Clone();
ourPart.Parent = cam;

--Manipulate part's collision
for _,v in next,allowed do
	if v == plr.Name then
		ourPart.CanCollide = false;
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.