How do I Limit the distance to view a billboard GUI ? The GUI is above a players head and I don't want people to see a load of writing over there screen when a player is over the other side of the map.. do I need to change the UDim position or something? Do I need a script for this? Any questions ill be happy to answer
Use Magnitude
01 | Put this in the brick: - |
02 | -Change GUI to your GUI's name |
03 |
04 | distance = 20 --If a player is closer than X studs it will show |
05 | while true do |
06 | players = game.Players:GetPlayers() |
07 | for i = 1 ,#players do |
08 | char = players [ i ] .Character |
09 | if (char.Torso.Position - script.Parent.Position).magnitude < distance+ 1 then |
10 | script.Parent.GUI.Visible = true |
11 | else |
12 | script.Parent.GUI.Visible = false |
13 | end |
14 | end |