|
| 13 Jul 2013 06:00 PM |
When a humaniod is near a brick, a Billboard GUI pops up ONLY for him, so only he can see the billboard Gui. And when he walks away from the brick, the Billboard GUI disappears. I cannot figure it out, I only got one part of the script which is:
BillboardGui.Enabled = True
and
BillboardGui.Enabled = False
|
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Jul 2013 06:31 PM |
http://wiki.roblox.com/index.php/Magnitude
That will help you find if a player is near something.
The code at the end, specifically, but reading the entire thing will help. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2013 06:52 PM |
Okay, I got this so far,
function FindNearestTorso(pos) local magnitude = (Brick2.Position - humanoid.Torso.Position).magnitude local distance = 4 if distance == 4 then BillboardGui.Enabled = true
end end
Any corrections and additions to make it how I want it? |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2013 06:53 PM |
Player:DistanceFromCharacter
Why does nobody use that..?
Also, put the GUI in their PlayerGui and set the adornee if you only want them to see it. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2013 07:50 PM |
I don't know where to put Player:DistanceFromCharacter but this is what I got and I bet it's wrong.
function FindNearestTorso(pos) local magnitude = (Brick2.Position - humanoid.Torso.Position).magnitude local Player:DistanceFromCharacter = 4 if Player:DistanceFromCharacter = 4 then BillboardGui.Enabled = true if Player:DistanceFromCharacter = 5+ then BillboardGui.Enabled = false
end end
--This would be put in PlayerGui
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 14 Jul 2013 01:00 AM |
if (workspace["NAMEOFBRICK"].Position - game.Players.LocalPlayer.Torso.Position).magntiude <= 4 then [GUI POPS UP CODE] end |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2013 01:05 AM |
I got this then
if (workspace["Brick2"].Position - game.Players.LocalPlayer.Torso.Position).magntiude <= 4 then BillboardGui.Enabled = true if (workspace["Brick2"].Position - game.Players.LocalPlayer.Torso.Position).magntiude >= 4 then BillboardGui.Enabled = false
end
|
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
| |
|
| |
|
| |
|
kubuto2
|
  |
| Joined: 16 Jul 2008 |
| Total Posts: 1275 |
|
|
| 14 Jul 2013 10:21 PM |
| Make the part local and then enable it when you get close to the part |
|
|
| Report Abuse |
|
|
DrWaffler
|
  |
| Joined: 16 Sep 2011 |
| Total Posts: 4248 |
|
|
| 14 Jul 2013 10:53 PM |
I NEVER use .magnitude for that..
player:DistanceFromCharacter()
ROBLOX is making my life easier, I ain't gonna tell 'em no. |
|
|
| Report Abuse |
|
|
| |
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Jul 2013 12:03 AM |
Never knew that method existed @ Dr
so would it be..?
plyr = game.Players.LocalPlayer
if plyr.DistanceFromCharacter(workspace.Part1.Position) <= 4 then
---stoof end |
|
|
| Report Abuse |
|
|
jasondee1
|
  |
| Joined: 26 Jul 2008 |
| Total Posts: 8002 |
|
|
| 15 Jul 2013 12:08 AM |
| Just do it the old fashioned way... use a detector brick.... you know... an invisible, walk throughable brick, sorrounding the brick, that will pop up the billboardgui when touched, and another detector surrounding that one for when the player walks away |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2013 12:09 AM |
@Infocus
Yes, and no. Instead of "plyr.DistanceFromCharacter", it is "plyr:DistanceFromCharacter"
[Here is the code I have so far--check if correct please]
plyr = game.Players.LocalPlayer
if plyr:DistanceFromCharacter(workspace.Brick2.Position) <= 4 then BillboardGui1.Enabled = true
end
|
|
|
| Report Abuse |
|
|
|
| 15 Jul 2013 12:12 AM |
Oh and, would this line make the BillboardGui1's parent the PlayerGui?
BillboardGui1.Parent = Player.PlayerGui
|
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
| |
|
|
| 15 Jul 2013 02:00 AM |
| My script still doesn't work |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 Jul 2013 01:58 PM |
Beasty,
That's not how u learn to script. Ur gonna have to read scripts for a few months before u start modifying scripts.
Go find a good script which does something u want to do; like GUI, or Distance detection; dissect it; understand why it does things the way it does, then modify it, slightly..... go from there....
|
|
|
| Report Abuse |
|
|
|
| 15 Jul 2013 02:08 PM |
| @BjCarpenter I have been, but this script isn't advanced at all. I am just stuck. |
|
|
| Report Abuse |
|
|