|
| 07 Oct 2013 07:47 PM |
| How do I make a script that detects when a player sits in a certain seat. I want the camera to be fixed on an invisible part (through a security camera ). I know the script is local but how do I connect the function? |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2013 07:49 PM |
| http://wiki.roblox.com/index.php/Seated_(Event) |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2013 07:50 PM |
to check if they sit in a seat, just do:
seat = game.Workspace.Seat seat.ChildAdded:connect(function(part) if part.ClassName == "Weld" then character = part.Part1.Parent player = game.Players:GetPlayerFromCharacter(character)
or something like that |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2013 07:51 PM |
| Still, how do I define and change the camera's position? |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2013 07:52 PM |
| game.Workspace.CurrentCamera.CoordinateFrame = Path.To.Security.Camera.Brick.CFrame |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2013 07:56 PM |
game.Workspace.Player.Humanoid.Seated:connect(function() game.Workspace.CurrentCamera.CoordinateFrame = Game.workspace.Bob.CFrame end) doesn't work |
|
|
| Report Abuse |
|
|
|
| 07 Oct 2013 08:01 PM |
Woah woah woah no.
Try this:
plr = game.Players.LocalPlayer chr = nil
plr.CharacterAdded:connect(function(character) chr = character chr.Humanoid.Seated:connect(function() game.Workspace.CurrentCamera.CoordinateFrame = game.workspace.Bob.CFrame end) end)
Make sure to put that in a LocalScript! I'm not certain on this, but I think the LocalScript should be directly in Workspace... |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Oct 2013 08:23 PM |
| Try just putting the CFrame values directly into that main line? |
|
|
| Report Abuse |
|
|