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

Work-around for getting player's position in Script?

I'm trying to make "A" happen below whenever a player is within 10 studs of part, but I cannot get the CurrentCamera because this is inside a Script and not a LocalScript. Is there a work-around for getting the player's position into "camera.CoordinateFrame.p" below?

Note: This is a single player game and there are no other players in the server.

camera = game.Workspace.CurrentCamera
part = --part location here

if (camera.CoordinateFrame.p - part.Position).magnitude < 10 then -- check if you're less than 10 studs away
	--A
end

1 comment

0

why not just use the players character ?

1 answer

✓ Accepted answer

There is no way to get the Camera object from the server.

You're going to have to either use a LocalScript, and put it in somewhere that replicates to the client - e.g. StarterPack or StarterGear - OR use a RemoteFunction to recieve the camera's data.

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