Walkspeed script not working..?

Okay so im making this script where it checks if the player is in mobile or not, if they are in mobile i enable the sprint value on starterplayerscripts and disable the value on the gui script.
The value is a check value it checks if they are in mobile or not, i found a solution where i disable one script but its permanently disabled, so i have to re-enable it but it just doesnt work again… I tried doing the value thing where it checks if the value is on or not before it sets any walkspeed and it does nothing… how would i fix this?

local players = game:GetService("Players")
local UIS = game:GetService("Players")
local isTouchscreen = UIS.TouchEnabled --checks if player is on a touchscreen device

players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		if isTouchScreen then
			hum.WalkSpeed = 50 --more walkspeed
		end
	end)
end)
1 Like