Need help on script

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.

2 Likes

Can you show me what you have so far? Assuming you’ve written a code-

2 Likes

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)

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.