chevron_leftchevron_leftchevron_left
    of     2   

communityescape
#168927295Monday, July 27, 2015 12:28 AM GMT

I found a reddit thing that helped alot: local position, onscreen = workspace.CurrentCamera:WorldToScreenPoint(part.Position) print(position.x,position.y,"It is ".. tostring(onscreen) .." that the part is on screen") --So that's what it meant by Vector3, bool. Now I know what that meant on the wiki --So onscreen & position can be changed name wise, but will always be known for as a Vector3 value and a bool value following it as long as WorldToScreenPoint is the thing being delt with. Good to know. Now I know how to switch from the billboardgui to screengui, now to figure out how to put the billboard gui in the middle of me and my enemy.
communityescape
#168929920Monday, July 27, 2015 12:59 AM GMT

Ok now I have a REAL code with my trial, error and notes to show to you guys: wait(2) --game.Workspace.CurrentCamera:WorldToScreenPoint(game.Workspace.Part.Position) --game.Workspace.CurrentCamera:WorldToScreenPoint(game.Workspace.Part) --game.Workspace.CurrentCamera:WorldToScreenPoint(game.Workspace.Part.Position-game.Workspace.Part2.Position) --game.Workspace.CurrentCamera:WorldToScreenPoint(game.Workspace.Part.Position) --[[while wait() do position, onscreen = game.Workspace.CurrentCamera:WorldToScreenPoint(game.Workspace.Part.Position)--You can change onscreen to what ever you want as long as you change it everywhere else aswell print(position.x,position.y,"It is ".. tostring(onscreen) .." that the part is on screen") -- 1300,1200, It is true that the part is on screen end]] --[[while wait() do position, onscreen = game.Workspace.CurrentCamera:WorldToScreenPoint(game.Workspace.Part.Position)--You can change onscreen to what ever you want as long as you change it everywhere else aswell print(position.x,position.y,"It is ".. tostring(onscreen) .." that the part is on screen") -- 1300,1200, It is true that the part is on screen if onscreen==false then--I tested it out and these types of if statements work aswell print("t1") elseif onscreen==true then print("t2") end end]] --Now time to test out WorldToViewportPoint --[[while wait() do position, onscreen = game.Workspace.CurrentCamera:WorldToViewportPoint(game.Workspace.Part.Position) print(position.x,position.y,"It is ".. tostring(onscreen) .." that the part is on screen") -- 1300,1200, It is true that the part is on screen if onscreen==false then--I tested it out and these types of if statements work aswell print("t1") --script.Parent.ScreenGui.Frame.Position = UDim2.new(0,position.x,0,position.y)--This goes to the opposite point script.Parent.ScreenGui.Frame.Position = UDim2.new(0,-position.x,0,-position.y) elseif onscreen==true then print("t2") end end]] --Before I go back to continuing WorldViewportPoitn im gonna try the same thing, but as WorldScreenPoint while wait() do--This is actually more accurate cause it says on where the pos is, so just add boundaries position, onscreen = game.Workspace.CurrentCamera:WorldToScreenPoint(game.Workspace.Part.Position) print(position.x,position.y,"It is ".. tostring(onscreen) .." that the part is on screen") -- 1300,1200, It is true that the part is on screen --if onscreen==false and script.Parent.ScreenGui.Frame.Position.X.Offset>=-1 and script.Parent.ScreenGui.Frame.Position.Y.Offset>=-1 and script.Parent.ScreenGui.Frame.Position.X.Offset<=1134 and script.Parent.ScreenGui.Frame.Position.Y.Offset<=650 then--I tested it out and these types of if statements work aswell --if onscreen==false and script.Parent.ScreenGui.Frame.Position.X.Offset<=script.Parent.ScreenGui.AbsoluteSize.X and script.Parent.ScreenGui.Frame.Position.Y.Offset<=script.Parent.ScreenGui.AbsoluteSize.Y then --if onscreen==false and script.Parent.ScreenGui.Frame.Position.X.Offset>=-1 and script.Parent.ScreenGui.Frame.Position.Y.Offset>=-1 then if onscreen==false then print("t1") script.Parent.ScreenGui.Frame.Position = UDim2.new(0,position.x,0,position.y) --This goes to the opposite point elseif onscreen==true then print("t2") --script.Parent.ScreenGui.Frame.Position = UDim2.new(0,0,0,0) end end
communityescape
#168930403Monday, July 27, 2015 1:05 AM GMT

In summary, WorldToScreenPoint is dead on and needs the boundaries of the AbsoluteSize property I tried to use for the ScreenGui im using. I tried making that the boundaries for the screengui to be at, cause my goal was to have the arrows run along the side of your screen pointing in the direction of you're enemy. I stopped using WorldToViewportPoint cause although it worked extremely well, it didn't slap dead onto the brick. With WorldToScreenPoint I could make it run along the edge of the screen by making parameters if statement wise. WorldToViewportPoint also points its self in the opposite direction of the thing I wanted to be pointing at. Now my question is, for the boundaries of WorldToScreenPoint I tried limiting the gui from going out of the screen range by using X & Y axis and the AbsoluteSize stuff in screen guis, but when I make the paremeters the gui doesen't show up much, let alone at all anymore. I've tried the following: --if onscreen==false and script.Parent.ScreenGui.Frame.Position.X.Offset>=-1 and script.Parent.ScreenGui.Frame.Position.Y.Offset>=-1 and script.Parent.ScreenGui.Frame.Position.X.Offset<=1134 and script.Parent.ScreenGui.Frame.Position.Y.Offset<=650 then--I tested it out and these types of if statements work aswell --if onscreen==false and script.Parent.ScreenGui.Frame.Position.X.Offset<=script.Parent.ScreenGui.AbsoluteSize.X and script.Parent.ScreenGui.Frame.Position.Y.Offset<=script.Parent.ScreenGui.AbsoluteSize.Y then --if onscreen==false and script.Parent.ScreenGui.Frame.Position.X.Offset>=-1 and script.Parent.ScreenGui.Frame.Position.Y.Offset>=-1 then -- After trying all of that if onscreen==false then is the only thing that will allow the screengui to stick on there, but I need parameters so it only runs along the side of the screen.
communityescape
#168935171Monday, July 27, 2015 1:55 AM GMT

bump cri
communityescape
#169833695Monday, August 03, 2015 7:49 PM GMT

t

chevron_leftchevron_leftchevron_left
    of     2