I made a script that gets ping, now I want to make a line graph that shows that information. But the lines do not match up at all with the plots.
Heres the script:
local TweenService = game:GetService("TweenService") local LastPlot = Vector2.new(0,0) script.Parent.Ping.Changed:Connect(function() local CurrentPlot = Vector2.new(1, 1 - (script.Parent.Ping.Value / 500)) local DataPoint = script.LineSegment:Clone() DataPoint.Position = UDim2.new(1, 0, 1 - (script.Parent.Ping.Value / 500), 0) DataPoint.Parent = script.Parent.Plots local LineSegment = script.LineSegment:Clone() LineSegment.AnchorPoint = Vector2.new(0,0) LineSegment.Position = UDim2.new(LastPlot.X, 0, LastPlot.Y, 0) LineSegment.Size = UDim2.new((CurrentPlot - LastPlot).Magnitude, 0, 0, 1) LineSegment.Rotation = 180/math.pi*math.atan((CurrentPlot.Y - LastPlot.Y)/(CurrentPlot.X - LastPlot.X)) LineSegment.Parent = script.Parent.Plots local LastPlot = Vector2.new(DataPoint.Position.X.Scale, DataPoint.Position.Y.Scale) local goal = {} goal.Position = UDim2.new(0, 0, 1 - (script.Parent.Ping.Value / 500), 0) local tweenInfo = TweenInfo.new(script.Parent.Speed.Value, 0) local tween1 = TweenService:Create(DataPoint, tweenInfo, goal) local tween2 = TweenService:Create(LineSegment, tweenInfo, goal) tween1:Play() tween2:Play() wait(script.Parent.Speed.Value) DataPoint:Destroy() wait() DataPoint:Destroy() end)
Sorry if this is a mess you only need to worry about lines 11-16
Defiantly a problem with my equation on line 13 but I'm not sure what I did wrong.
(CurrentPlot - LastPlot).Magnitude
Here im trying to get the distance (In scale not offset) between the two Vector2s.
Here is the Explorer
Here is the Results
I know there is a problem with the tweening and destroying but I can fix that myself
Locked by Leamir
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?