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: When humaniod is near brick, Billboard GUI pops up

Previous Thread :: Next Thread 
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
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
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
13 Jul 2013 06:11 PM
Bump
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
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
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
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
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
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
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
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
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
13 Jul 2013 08:05 PM
Bump
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
14 Jul 2013 12:45 AM
Bump
Report Abuse
Infocus is not online. 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
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
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 is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
14 Jul 2013 01:07 AM
So much facepalm.
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
14 Jul 2013 01:08 AM
.?
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
14 Jul 2013 09:03 PM
Bump
Report Abuse
kubuto2 is not online. 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 is not online. 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
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
14 Jul 2013 11:25 PM
B2
Report Abuse
Infocus is not online. 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 is not online. 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
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
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
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
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 is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
15 Jul 2013 01:39 AM
Typo <3
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
15 Jul 2013 02:00 AM
My script still doesn't work
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
15 Jul 2013 01:24 PM
B3
Report Abuse
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
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
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
15 Jul 2013 02:08 PM
@BjCarpenter I have been, but this script isn't advanced at all. I am just stuck.
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