So um i made a Waypoint marker that tracks the Player’s PrimaryPart to the Waypoint, I rounded the number and got a whole number, but i was wondering, how to i get a tenth to appear alongside the number
Script: (Sorry for the weird Variable names, i was changing the paths)
Completed = false
while wait() do
PlayersPrimaryPartPos = game.Players.LocalPlayer.Character.PrimaryPart
PartPos = workspace.Waypoints_Marker:FindFirstChild("WayPoint1")
local Magnitude = (PlayersPrimaryPartPos.Position - PartPos.Position).Magnitude
PartPos.BillboardGui.PositionLength.Text = math.ceil(Magnitude).."m"
if (PlayersPrimaryPartPos.Position - PartPos.Position).Magnitude <= 5 then
Completed = not Completed
PartPos.Sound:Play()
PartPos.BillboardGui.ExtentsOffsetWorldSpace = Vector3.new(0,-5,0)
PartPos.BillboardGui.PositionLength.Text = ""
PartPos.BillboardGui.Pointer.Size = UDim2.new(1,0,1,0)
PartPos.BillboardGui.Pointer.Text = "✅"
break
end
end
for i = 1,100 do
wait()
PartPos.Transparency += 0.01
end
PartPos:Destroy()
To make myself more clear, i want a decimal, so like 13.7 or something.
Anything helps.
--//Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
--//Variables
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local PrimaryPart = Character.PrimaryPart
local Waypoint = workspace.Waypoints_Marker:WaitForChild("WayPoint1")
--//Functions
local function roundNumber(number)
return tonumber(string.format("%.1f", number))
end
while task.wait() do
local Magnitude = (PrimaryPart.Position - Waypoint.Position).Magnitude
Waypoint.BillboardGui.PositionLength.Text = roundNumber(Magnitude) .."m"
if Magnitude <= 5 then
Waypoint.Sound:Play()
Waypoint.BillboardGui.ExtentsOffsetWorldSpace = Vector3.new(0, -5, 0)
Waypoint.BillboardGui.PositionLength.Text = ""
Waypoint.BillboardGui.Pointer.Size = UDim2.new(1, 0, 1,0)
Waypoint.BillboardGui.Pointer.Text = "✅"
break
end
end
local transparencyTween = TweenService:Create(Waypoint, TweenInfo.new(1, Enum.EasingStyle.Quint), {Transparency = 1})
transparencyTween:Play()
transparencyTween.Completed:Wait()
Waypoint:Destroy()
--//Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
--//Variables
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local PrimaryPart = Character.PrimaryPart
local Waypoint = workspace.Waypoints_Marker:WaitForChild("WayPoint1")
--//Functions
local function roundNumber(number)
return tonumber(string.format("%.1f", number))
end
while task.wait() do
PrimaryPart = Character.PrimaryPart
local Magnitude = (PrimaryPart.Position - Waypoint.Position).Magnitude
Waypoint.BillboardGui.PositionLength.Text = roundNumber(Magnitude) .."m"
if Magnitude <= 5 then
Waypoint.Sound:Play()
Waypoint.BillboardGui.ExtentsOffsetWorldSpace = Vector3.new(0, -5, 0)
Waypoint.BillboardGui.PositionLength.Text = ""
Waypoint.BillboardGui.Pointer.Size = UDim2.new(1, 0, 1,0)
Waypoint.BillboardGui.Pointer.Text = "✅"
break
end
end
local transparencyTween = TweenService:Create(Waypoint, TweenInfo.new(1, Enum.EasingStyle.Quint), {Transparency = 1})
transparencyTween:Play()
transparencyTween.Completed:Wait()
Waypoint:Destroy()
--//Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
--//Variables
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local PrimaryPart = Character:WaitForChild("HumanoidRootPart")
local Waypoint = workspace.Waypoints_Marker:WaitForChild("WayPoint1")
--//Functions
local function roundNumber(number)
return tonumber(string.format("%.1f", number))
end
while task.wait() do
local Magnitude = (PrimaryPart.Position - Waypoint.Position).Magnitude
Waypoint.BillboardGui.PositionLength.Text = roundNumber(Magnitude) .."m"
if Magnitude <= 5 then
Waypoint.Sound:Play()
Waypoint.BillboardGui.ExtentsOffsetWorldSpace = Vector3.new(0, -5, 0)
Waypoint.BillboardGui.PositionLength.Text = ""
Waypoint.BillboardGui.Pointer.Size = UDim2.new(1, 0, 1,0)
Waypoint.BillboardGui.Pointer.Text = "✅"
break
end
end
local transparencyTween = TweenService:Create(Waypoint, TweenInfo.new(1, Enum.EasingStyle.Quint), {Transparency = 1})
transparencyTween:Play()
transparencyTween.Completed:Wait()
Waypoint:Destroy()
Ohh, the video didn’t load before I made my post. The only reason the numbers are flickering is because it reached exactly a whole number, which is why no decimal points were shown.
--//Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
--//Variables
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local PrimaryPart = Character.PrimaryPart
local Waypoint = workspace.Waypoints_Marker:WaitForChild("WayPoint1")
--//Functions
local function roundNumber(number)
return tonumber(string.format("%.1f", number))
end
while task.wait() do
PrimaryPart = Character.PrimaryPart
local Magnitude = (PrimaryPart.Position - Waypoint.Position).Magnitude
local roundedNumber = roundNumber(Magnitude)
if roundedNumber % 1 == 0 then
roundedNumber = tostring(roundedNumber.. ".0")
end
Waypoint.BillboardGui.PositionLength.Text = roundedNumber .."m"
if Magnitude <= 5 then
Waypoint.Sound:Play()
Waypoint.BillboardGui.ExtentsOffsetWorldSpace = Vector3.yAxis * -5
Waypoint.BillboardGui.PositionLength.Text = ""
Waypoint.BillboardGui.Pointer.Size = UDim2.fromScale(1, 1)
Waypoint.BillboardGui.Pointer.Text = "✅"
break
end
end
local transparencyTween = TweenService:Create(Waypoint, TweenInfo.new(1, Enum.EasingStyle.Quint), {Transparency = 1})
transparencyTween:Play()
transparencyTween.Completed:Wait()
Waypoint:Destroy()