✓ Accepted answer
The camera object is only accessible from the client. You will have to setup a RemoteEvent, and then use the FireClient function to send arguments to the client. Use a localscript to connect this RemoteEvent, and do the camera manipulation from there.
You can setup a PlayerAdded event, along with a Chatted event to recieve when any player in the game talks.
- Place a RemoteEvent in ReplicatedStorage.
Server script
local admins = {["Player1"] = true, ["iGlaciem"] = true, ["Goulstem"] = true}
local re = game.ReplicatedStorage.AdminRemote
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if admins[plr.Name] then
if msg:sub(1,5):lower() == "view;" then
local target = msg:sub(6);
re:FireClient(plr,target);
end
end
end)
end)
LocalScript
local plr = game.Players.LocalPlayer;
local cam = workspace.CurrentCamera;
local re = game.ReplicatedStorage.AdminRemote;
re.OnClientEvent:Connect(function(target)
targ = game.Players[target].Character.HumanoidRootPart;
cam.CameraSubject = targ;
cam.CoordinateFrame = CFrame.new(
(targ.CFrame * CFrame.new(0,5,-5)).p,
targ.CFrame
)
end)
1 comment
Here is a good tutorial by ROBLOX to help you. I do not feel like answering your question because all the information you need is on here: http://wiki.roblox.com/index.php?title=Chat_commands