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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 25 Feb 2014 03:13 PM |
Awesome, totally works!
Thanks Wazup! :D
-Bogy |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
| |
|
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 |
|
|
|
| 25 Feb 2014 03:17 PM |
| I need help can you guys teach me script and other ppl thx k bye |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 25 Feb 2014 03:26 PM |
/!\ WARNING /!\ only local scripts run inside camera |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
| |
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 25 Feb 2014 04:28 PM |
Kk, thanks for the help everyone!
-bogy |
|
|
| Report Abuse |
|
|