Freeze command not working on mobile?

I have a command freezing people but doesn’t work on mobile,I think it’s because of the thumbstick or whatever it’s called but idk how to fix it.
Here’s the script:

local repStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local Event = repStorage:WaitForChild("Freeze")
local List = game.StarterGui.Admin2.Commands.List.TextButton

Event.OnServerEvent:Connect(function(plr, targetName)
	local target = players:FindFirstChild(targetName)
	if target then --check for the player (again cuz the check on the client is bypassable with exploits)
		
		local char = plr.Character
		if char then
			local hum = char:FindFirstChildOfClass("Humanoid")
			if hum then
				hum.WalkSpeed = 0
				hum.JumpPower = 0

			end
		end -- Freeze Script (target is the player to freeze)
		
		print(plr.Name .. " froze " .. targetName)
	end
end)

@Cypacic Have you tried putting it in a GUI?

Perhaps explain briefly?
Im stupid lol

yes please :slightly_smiling_face:

sorry I mean you explaining briefly :sweat_smile:

Can we see the client script if possible?

local repStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local Event = repStorage:WaitForChild("Freeze") -- you can also use just an event for all the commands

local list = script.Parent.Commands.List
local Group = script.Parent.Commands
local freezeBtn = Group.Freeze -- freeze button
local target = ""

freezeBtn.MouseButton1Click:Connect(function()
	if players:FindFirstChild(target) then --check for the player
		Event:FireServer(target)
	else
		print("Invalid Name")
	end
end)

for _, v in pairs(list:GetChildren()) do
	if v:IsA("TextButton") then
		v.MouseButton1Click:Connect(function()
			target = v.Text
			
local selectionColor = Color3.fromRGB(255, 0, 0) --pick the color you want
local defaultColor = Color3.fromRGB(255, 255, 255) --pick the current color

			for _, i in pairs(list:GetChildren()) do
				i.BackgroundColor3 = defaultColor
			end

			v.BackgroundColor3 = selectionColor
		end)
	end
end
local repStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local Event = repStorage:WaitForChild("Freeze")

Event.OnServerEvent:Connect(function(plr, targetName)
	local target = players:FindFirstChild(targetName)
	if target then --check for the player (again cuz the check on the client is bypassable with exploits)
		
		local char = plr.Character
		if char then
                       char.HumanoidRootPart.Anchored = true -- stops player from moving
		end -- Freeze Script (target is the player to freeze)
		
		print(plr.Name .. " froze " .. targetName)
	end
end)