Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago

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
0
why not just use the players character ? User#5423 17 — 7y

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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.

Ad

Answer this question