Conversion to percent. Speed gained or lost

local bool = false
script.Parent.Touched:connect(function(hit)
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") and not bool then
		bool = true
		hit.Parent.Humanoid.WalkSpeed -=35
		wait(X)
		bool = false
	end
end)```

If you know how I can convert this into a percent please help me

What are you trying to convert in to a percent? Also this isn’t the right sub-category for your problem.

Something like this should do:

Code

local players = game:GetService("Players")

local part = script.Parent
local boolean = false

local cooldown = 3
local percentage = 50 -- 50% out of 100%
local maxWalkSpeed = 100

part.Touched:connect(function(other)
	local player = players:GetPlayerFromCharacter(other.Parent)
	if player and not boolean then
		boolean = true
		local humanoid = player.Character:FindFirstChild("Humanoid")
		humanoid.WalkSpeed -= math.floor(humanoid.WalkSpeed / maxWalkSpeed * percentage)
		wait(cooldown)
		boolean = false
	end
end)

I also cleaned your code up, just so that it looks better.
Welp mainly for me tbh.

If worked, then mark as the solution.

What if I want this to be a negative so the player looses his speed by 10%???