Hey!
i really need help script when going up(climbing) the text label(gui) will calculate the meter you go 1meter,2meter,100meter
Thanks!
Hey!
i really need help script when going up(climbing) the text label(gui) will calculate the meter you go 1meter,2meter,100meter
Thanks!
You can project a ray downward from the playerâs character to detect how far the player is from the ground. Or you can set an origin point on the Y axis, then access the playerâs (characterâs) Y axis and determine how far they are from the origin point.
Twenty Roblox studs is equivalent to one meter. This can be used to convert the studs to meters.
Can you show me what you have so far? Assuming youâve written a code-
Hey!
local Text = script.Parent
wait(1)
local Player = game.Players.LocalPlayer
local Char = Player.Character
game:GetService(âRunServiceâ).Stepped:Connect(function()
Text.Text = "Altitude: "âŚmath.ceil(Char.HumanoidRootPart.Position.Y)
end)
I already have the script but this is Altitude i dont want Altitude i want meter
â Make sure to insert a TextLabel GUI object in StarterGui named âClimbMeterâ
local climbMeter = game:GetService(âStarterGuiâ).ClimbMeter
â Variables to keep track of the playerâs position and meters climbed
local player = game.Players.LocalPlayer
local lastPosition = player.Character.HumanoidRootPart.Position
local metersClimbed = 0
â Function to calculate the distance climbed by the player
local function calculateClimb()
local currentPosition = player.Character.HumanoidRootPart.Position
local climbDistance = math.abs(currentPosition.Y - lastPosition.Y)
metersClimbed = metersClimbed + climbDistance
lastPosition = currentPosition
climbMeter.Text = "Meters Climbed: " ⌠tostring(math.floor(metersClimbed))
end
â Run the âcalculateClimbâ function every frame while the player is climbing
game:GetService(âRunServiceâ).RenderStepped:Connect(function()
if player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Climbing then
calculateClimb()
end
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.