Player = game.Players.LocalPlayer repeat wait() until Player.Character Character = Player.Character gui = game.ReplicatedStorage.Text:Clone() while true do magnitude = (workspace.CopHat.Position - Character.Torso.Position).magnitude if gui.Parent == nil and magnitude < 20 and Character.Torso.Position.Vector3.x > -17.547 then gui.Parent = Player.PlayerGui gui.FrameOne:TweenPosition(UDim2.new(0.3, 0, 0.75, -5)) gui.FrameTwo:TweenPosition(UDim2.new(0.45, 0, 0.75, -5)) gui.FrameThree:TweenPosition(UDim2.new(0.6, 0, 0.75, -5)) gui.NameLabel:TweenPosition(UDim2.new(0.1, 0, 0.75, -5)) gui.Textbox:TweenPosition(UDim2.new(0.1, 0, 0.8, 0)) elseif magnitude >= 20 then gui.FrameOne.Position = UDim2.new(0.3, 0, 1, 0) gui.FrameTwo.Position = UDim2.new(0.45, 0, 1, 0) gui.FrameThree.Position = UDim2.new(0.6, 0, 1, 0) gui.NameLabel.Position = UDim2.new(0.1, 0, 1, 0) gui.Textbox.Position = UDim2.new(0.1, 0, 1, 0) gui.Parent = nil end print(magnitude, gui.Parent) wait(0.1) end
The problem stems on line 10. I want the gui to show up when the player is close enough, the gui is not in the player's PlayerGui yet, and the player is facing the object (not behind it). My problem is finding out how to define that third qualification. I've tried making the script check the Player's position on the x axis and determine if they are "in front of" the object. The output says that Vector3 is not a valid member of Position. How do I access that x value in Position?