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: Make other players invisible ONLY to you?

Previous Thread :: Next Thread 
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
25 Feb 2014 03:00 PM
I am attempting to create a script that makes other players appear invisible ONLY to you (in other words creating the effect that you are the only one in the game).

So far I have this script, but it doesn't work. There are no errors, even in Test > Start Server/Player.

wait(1)
game.Players.ChildAdded:connect(function(newPlayer)
players = game.Players:GetChildren()
for i,v in pairs(game.Players:GetChildren()) do
if v.Name ~= (game.Players.LocalPlayer.Name) then
for a,b in pairs(v.Character:GetChildren()) do
if b.ClassName == "Part" then
b.Transparency = 1
end
end
end
end
end)



P.S. This is a Local Script in StarterGui.

Thanks for any help,
-Bogy
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
25 Feb 2014 03:06 PM
In LocalScript

repeat wait() until
game.Players.LocalPlayer.Character

game.Players.LocalPlayer.Character.Parent = workspace.CurrentCamera
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
25 Feb 2014 03:11 PM
Here is my revised script:

repeat wait() until game.Players.LocalPlayer.Character
game.Players.LocalPlayer.Character.Parent = workspace.CurrentCamera

game.Players.ChildAdded:connect(function(newPlayer)
while newPlayer ~= nil and newPlayer.Character == nil do
wait(0.1)
end
players = game.Players:GetChildren()
for i,v in pairs(game.Players:GetChildren()) do
if v.Name ~= (game.Players.LocalPlayer.Name) then
for a,b in pairs(v.Character:GetChildren()) do
if b.ClassName == "Part" then
b.Transparency = 1
end
end
end
end
end)

Would this work?
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
25 Feb 2014 03:13 PM
Awesome, totally works!

Thanks Wazup! :D

-Bogy
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
25 Feb 2014 03:13 PM
I woulda toldcha:put the players character into the camera..

but wazap beat me to it...again..lol
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
25 Feb 2014 03:14 PM
Wazap* :P
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
25 Feb 2014 03:15 PM
So wait, all you do is put your Player's Character into your Camera and all other people vanish?

Weird o.O
Report Abuse
XxMusicGurlXx is not online. XxMusicGurlXx
Joined: 29 Jan 2012
Total Posts: 14
25 Feb 2014 03:17 PM
I need help can you guys teach me script and other ppl thx k bye
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
25 Feb 2014 03:18 PM
every player is game.Players.LocalPlayer btw..
ex:
localscript in startergui
plr = game.Players.LocalPlayer--this is the current player
repeat wait() until plr.Character
plr.Character.Parent = Workspace.CurrentCamera--this puts this player into the current camera,making it only visible to himself
ex,a part in a single players camera would only be seen by the player itself
so if the player is in the camera
the others cant see him,and he cant see others,as they are in their own camera
hope u get it:D
Report Abuse
GiganticGulian is not online. GiganticGulian
Joined: 18 Feb 2011
Total Posts: 2233
25 Feb 2014 03:26 PM
/!\ WARNING /!\
only local scripts run inside camera
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
25 Feb 2014 03:40 PM
Okay, so if I were to clone a model from Lighting and place it in Workspace.CurrentCamera using a local script would mean only YOU can interact with it / see it?
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
25 Feb 2014 03:41 PM
Only I* :P
Report Abuse
GiganticGulian is not online. GiganticGulian
Joined: 18 Feb 2011
Total Posts: 2233
25 Feb 2014 03:41 PM
You can only see it,
but it wont work because scripts don't run there.
or you'll have to use localscripts and put them into your character.
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
25 Feb 2014 03:43 PM
ex:
StarterGui
-LocalScript

repeat wait() until game.Players.LocalPlayer.Character
if game.Players.LocalPlayer.Name== "yourname" then
p = Instance.new("Part",Workspace.CurrentCamera)
p.Size= Vector3.new(5,1,5)
p.Anchored = true
p.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame*CFrame.new(0,5,-10)
end
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
25 Feb 2014 03:47 PM
@Island, that would create a part that only YOU can interact with?

I just tried it in studio and I believe it works. I created a part using Instance.new and only I could see/interact with it.
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
25 Feb 2014 03:48 PM
mmmhmmmmm
local parts
:D
haxy method btw,might be glitch,and can change at any time,because if roblox suddenly changed the way cameras work..
could break the whole thing
-source:roblox wiki-
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
25 Feb 2014 03:49 PM
and bogy,try using my script and changing it to check if name = "Player1"
if it is,then do the stuff..
and then start server
start player
start another player(from server window)
player2 shouldn't be able to interact with the part
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
25 Feb 2014 04:28 PM
Kk, thanks for the help everyone!

-bogy
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