generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: KeyDown and CameraSubject

Previous Thread :: Next Thread 
ayub32 is not online. ayub32
Joined: 27 Dec 2009
Total Posts: 485
02 Mar 2014 04:43 PM
I have a script that you can change camera subjects like on murder mystery but it does not work


plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
mouse.KeyDown:connect(function(key)
if key:lower()=="q" then
game.Workspace.CurrentCamera.CameraSubject=game.Workspace.Rifle
elseif key:lower()=="e" then
game.Workspace.CurrentCamera.CameraSubject=game.Workspace.Frame
end
end)
mouse.KeyUp:connect(function(key)
if key=="q"then
return
end
if key:lower()=="e"then
return

end

end)
Report Abuse
ayub32 is not online. ayub32
Joined: 27 Dec 2009
Total Posts: 485
03 Mar 2014 05:44 AM
Bump need help
Report Abuse
ayub32 is not online. ayub32
Joined: 27 Dec 2009
Total Posts: 485
03 Mar 2014 03:10 PM
Bump
Report Abuse
luigi9313 is not online. luigi9313
Joined: 07 May 2009
Total Posts: 1496
03 Mar 2014 03:46 PM
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
mouse.KeyDown:connect(function(key)
if key:lower() == "q" then
game.Workspace.CurrentCamera.CameraSubject=game.Workspace.Rifle
elseif key:lower()=="e" then
game.Workspace.CurrentCamera.CameraSubject=game.Workspace.Frame
end
end)
mouse.KeyUp:connect(function(key)
return
end)

To make sure:
It has to be a localscript. Is this a GUI, clicked part, or tool? It's not specifying.
Report Abuse
ayub32 is not online. ayub32
Joined: 27 Dec 2009
Total Posts: 485
03 Mar 2014 05:04 PM
Just a localscript, I will implement it into a GUI soon
Report Abuse
ayub32 is not online. ayub32
Joined: 27 Dec 2009
Total Posts: 485
03 Mar 2014 05:10 PM
Yea mine worked yours does too but it can't keep on switching through the camera views
Report Abuse
ayub32 is not online. ayub32
Joined: 27 Dec 2009
Total Posts: 485
03 Mar 2014 05:18 PM
Please help
Report Abuse
ayub32 is not online. ayub32
Joined: 27 Dec 2009
Total Posts: 485
03 Mar 2014 06:10 PM
Anybody?
Report Abuse
ayub32 is not online. ayub32
Joined: 27 Dec 2009
Total Posts: 485
03 Mar 2014 06:27 PM
Please help it's needed
Report Abuse
ayub32 is not online. ayub32
Joined: 27 Dec 2009
Total Posts: 485
03 Mar 2014 07:20 PM
Bump
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
03 Mar 2014 07:36 PM
ps = {}
N = 0
game.Players.PlayerAdded(function(plr)
table.insert(ps, plr.Name)
for I = 1,#ps do
N = N + 1
end
end)
game.Players.PlayerRemoving(function(plr)
table.remove(ps, plr.Name)
N = N - 1
end)
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
mouse.KeyDown:connect(function(key)
CurrentView = 1
if key:lower()=="q" then
if CurrentView~=1 then
game.Workspace.CurrentCamera.CameraSubject=game.Players[ps[CurrentView]].Character.Head
else end
elseif key:lower()=="e" then
if CurrentView~=N then
game.Workspace.CurrentCamera.CameraSubject=game.Players[ps[CurrentView]].Character.Head
else end
end
end)
mouse.KeyUp:connect(function(key)
if key=="q"then
return
end
if key:lower()=="e"then
return

end

end)


--I'm not completely sure on that.. Test it
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
03 Mar 2014 07:41 PM
OPPS;


ps = {}
N = 0
game.Players.PlayerAdded(function(plr)
table.insert(ps, plr.Name)
for I = 1,#ps do
N = N + 1
end
end)
game.Players.PlayerRemoving(function(plr)
table.remove(ps, plr.Name)
N = N - 1
end)
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
mouse.KeyDown:connect(function(key)
CurrentView = 1
if key:lower()=="q" then
if CurrentView~=1 then
CurrentView = CurrentView - 1
game.Workspace.CurrentCamera.CameraSubject=game.Players[ps[CurrentView]].Character.Head
elseif CurrentView==1 then
CurrentView = N
game.Workspace.CurrentCamera.CameraSubject=game.Players[ps[CurrentView]].Character.Head
end
elseif key:lower()=="e" then
if CurrentView~=N then
CurrentView = CurrentView + 1
game.Workspace.CurrentCamera.CameraSubject=game.Players[ps[CurrentView]].Character.Head
elseif CurrentView==N then
CurrentView = 1
game.Workspace.CurrentCamera.CameraSubject=game.Players[ps[CurrentView]].Character.Head
end
end
end)
mouse.KeyUp:connect(function(key)
if key=="q"then
return
end
if key:lower()=="e"then
return

end

end)


--I'm not completely sure on that.. Test it (REVISED)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image