local Y=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local p=require(Y.GraspDetection)local r=script.Parent.Thresholds local b,h=r.ThresholdName,r.ThresholdValue local D=p.GetThresholds()local g=1 b.Text=D[g]h.Text=p.GetThresholdValue(D[g])b.Activated:Connect(function()g+=1 if g>#D then g=1 end b.Text=D[g]h.Text=p.GetThresholdValue(D[g])end)h.FocusLost:Connect(function(Y)if not Y then return end p.UpdateThreshold(D[g],tonumber(h.Text))h.Text=p.GetThresholdValue(D[g])end)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GraspDetection = require(ReplicatedStorage.GraspDetection)

local Thresholds = script.Parent.Thresholds
local TName, TValue = Thresholds.ThresholdName, Thresholds.ThresholdValue

local THRESHOLDS = GraspDetection.GetThresholds()
local ThresholdIndex = 1

TName.Text = THRESHOLDS[ThresholdIndex]
TValue.Text = GraspDetection.GetThresholdValue(THRESHOLDS[ThresholdIndex])

TName.Activated:Connect(function()
  ThresholdIndex += 1
  
  if ThresholdIndex > #THRESHOLDS then
    ThresholdIndex = 1
  end
  
  TName.Text = THRESHOLDS[ThresholdIndex]
  TValue.Text = GraspDetection.GetThresholdValue(THRESHOLDS[ThresholdIndex])
end)

TValue.FocusLost:Connect(function(enterPressed)
  if not enterPressed then
    return
  end
  
  GraspDetection.UpdateThreshold(THRESHOLDS[ThresholdIndex], tonumber(TValue.Text))
  TValue.Text = GraspDetection.GetThresholdValue(THRESHOLDS[ThresholdIndex])
end)
