RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a script with a draggable gui that gives me the option to change the amount of health I have"
-- local script inside a draggable GUI local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local gui = script.Parent local healthSlider = gui.HealthSlider local healthValue = gui.HealthValue local function updateHealth() local newHealth = tonumber(healthValue.Text) if newHealth and newHealth >= 0 and newHealth <= humanoid.MaxHealth then humanoid.Health = newHealth else healthValue.Text = tostring(humanoid.Health) end end healthSlider.MouseButton1Down:Connect(function() local mouse = player:GetMouse() local dragging = true local initialPos = gui.Position local function drag() if dragging then local newPos = UDim2.new(0, mouse.X, 0, mouse.Y) gui.Position = newPos end end mouse.Move:Connect(drag) mouse.Button1Up:Connect(function() dragging = false end) end) healthValue.FocusLost:Connect(updateHealth)