NightPyro
|
  |
| Joined: 22 Apr 2012 |
| Total Posts: 183 |
|
|
| 09 Nov 2012 02:02 PM |
distance = 4
while true do wait(.1) for i,v in pairs(game.Players:GetChildren()) do human = v.Character:FindFirstChild("Torso") if human ~= nil and (game.Workspace.Door1.Position - human.Position).magnitude <= distance then if (game.Workspace.Door1.Position - human.Position).magnitude <= distance then
v.PlayerGui.MainHUD.Buy.Dooor1.Visible = true--I think it would be v to access the player defined in the pairs thingy... if (game.Workspace.Door1.Position - human.Position).magnitude >= distance then v.PlayerGui.MainHUD.Buy.Dooor1.Visible = false end end end
end
end
I can make the gui pop up on the screen, but i can't figure out how to make it go away.. When you walk away from the brick. |
|
|
| Report Abuse |
|
|
NightPyro
|
  |
| Joined: 22 Apr 2012 |
| Total Posts: 183 |
|
| |
|
|
| 09 Nov 2012 02:10 PM |
You have an if statement checking for magnitude. Simply add an else block to that statement that sets the GUI visibility to false |
|
|
| Report Abuse |
|
|
NightPyro
|
  |
| Joined: 22 Apr 2012 |
| Total Posts: 183 |
|
|
| 09 Nov 2012 02:16 PM |
| I already tried that.. It doesn't work.. |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2012 02:19 PM |
This will be hard to explain on my phone. Otherwise I'd just give you the script. Here goes.
Your second if statement that checks magnitude? Scrap it. Use an else statement for that instead. |
|
|
| Report Abuse |
|
|
NightPyro
|
  |
| Joined: 22 Apr 2012 |
| Total Posts: 183 |
|
|
| 09 Nov 2012 02:29 PM |
distance = 4
while true do wait(.1) for i,v in pairs(game.Players:GetChildren()) do human = v.Character:FindFirstChild("Torso") if human ~= nil and (game.Workspace.Door1.Position - human.Position).magnitude <= distance then v.PlayerGui.MainHUD.Buy.Dooor1.Visible = true--I think it would be v to access the player defined in the pairs thingy... else (game.Workspace.Door1.Position - human.Position).magnitude <= distance then wait(.1) v.PlayerGui.MainHUD.Buy.Dooor1.Visible = false
end
end end
end Is this what you mean? I have an error on line 9.. but is this what you mean?
Note: Line 9 error is abotut he "<=" |
|
|
| Report Abuse |
|
|
crouton04
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 4459 |
|
|
| 09 Nov 2012 02:57 PM |
distance = 4
while true do wait(.1) for i,v in pairs(game.Players:GetChildren()) do human = v.Character:FindFirstChild("Torso") if human ~= nil and (game.Workspace.Door1.Position - human.Position).magnitude <= distance then v.PlayerGui.MainHUD.Buy.Dooor1.Visible = true--I think it would be v to access the player defined in the pairs thingy... else (game.Workspace.Door1.Position - human.Position).magnitude = distance wait(.1) v.PlayerGui.MainHUD.Buy.Dooor1.Visible = false
end
end end
--- this should work.. |
|
|
| Report Abuse |
|
|
NightPyro
|
  |
| Joined: 22 Apr 2012 |
| Total Posts: 183 |
|
|
| 09 Nov 2012 05:09 PM |
| Uhmm, i still can't figure it out.. Sorry. |
|
|
| Report Abuse |
|
|
|
| 09 Nov 2012 05:32 PM |
| Get rid of the condition in the else block. Set the visibility to false in the else block. Also get rid of the wait in the else block. |
|
|
| Report Abuse |
|
|